Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FCD_aggregation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lukas Rapant
FCD_aggregation
Commits
53ce3931
Commit
53ce3931
authored
7 years ago
by
Vit Ptosek
Browse files
Options
Downloads
Patches
Plain Diff
updated recalc
parent
e9354d70
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
FcdAggregationLauncher/FcdAggregationLauncher/Launcher.cs
+26
-2
26 additions, 2 deletions
FcdAggregationLauncher/FcdAggregationLauncher/Launcher.cs
FcdAggregationLauncher/FcdAggregationLauncher/Settings/FolderWatcher.cs
+1
-1
1 addition, 1 deletion
...Launcher/FcdAggregationLauncher/Settings/FolderWatcher.cs
with
27 additions
and
3 deletions
FcdAggregationLauncher/FcdAggregationLauncher/Launcher.cs
+
26
−
2
View file @
53ce3931
...
...
@@ -82,10 +82,13 @@ namespace FcdAggregationLauncher {
foreach
(
var
file
in
files
)
{
mergingContent
.
Append
(
File
.
ReadAllText
(
file
.
FullName
));
File
.
Delete
(
file
.
FullName
);
//
File.Delete(file.FullName);
if
(++
count
%
MERGING_MINUTES
==
0
)
{
File
.
AppendAllText
(
$"Output/Merged/
{
file
.
LastWriteTimeUtc
.
ToFileFormat
()}
.csv"
,
mergingContent
.
ToString
());
var
path
=
$"Output/Merged/
{
file
.
LastWriteTimeUtc
.
ToFileFormat
()}
.csv"
;
File
.
AppendAllText
(
path
,
mergingContent
.
ToString
());
FireUpAggregation
(
path
,
out
string
outputFilePath
);
mergingContent
.
Clear
();
}
}
...
...
@@ -93,11 +96,32 @@ namespace FcdAggregationLauncher {
return
count
;
}
public
static
void
FireUpReprocessMergingByTimestamp
(
FolderWatcher
settings
)
{
var
directory
=
new
DirectoryInfo
(
settings
.
DirectoryPath
);
var
searchOption
=
settings
.
WatchSubdirectories
?
SearchOption
.
AllDirectories
:
SearchOption
.
TopDirectoryOnly
;
var
startTime
=
settings
.
StartTime
;
while
(
startTime
<
settings
.
FinishTime
)
{
var
files
=
from
file
in
directory
.
EnumerateFiles
(
$"*.
{
settings
.
FileType
}
"
,
searchOption
)
where
IsFileFromTimeRange
(
file
,
startTime
)
orderby
file
.
LastWriteTimeUtc
select
file
;
foreach
(
var
file
in
files
)
{
Console
.
WriteLine
(
file
.
Name
);
}
}
}
public
static
int
FireUpDbExport
(
string
dbPassword
,
string
filePath
)
{
var
db
=
new
Database
(
dbPassword
);
var
rowCount
=
db
.
ExportData
(
filePath
,
MERGING_MINUTES
);
return
rowCount
;
}
private
static
bool
IsFileFromTimeRange
(
FileInfo
file
,
DateTime
?
startTime
)
{
return
file
.
LastWriteTimeUtc
.
AddMinutes
(
MERGING_MINUTES
*
-
1
)
>
startTime
&&
file
.
LastWriteTimeUtc
.
AddMinutes
(
MERGING_MINUTES
*
-
1
)
<=
startTime
.
Value
.
AddMinutes
(
MERGING_MINUTES
);
}
}
}
This diff is collapsed.
Click to expand it.
FcdAggregationLauncher/FcdAggregationLauncher/Settings/FolderWatcher.cs
+
1
−
1
View file @
53ce3931
...
...
@@ -32,7 +32,7 @@ namespace FcdAggregationLauncher.Settings {
DirectoryPath
=
(
string
)
element
.
Attribute
(
"Path"
),
WatchSubdirectories
=
(
bool
)
element
.
Attribute
(
"WatchSubdirectories"
),
StartTime
=
String
.
IsNullOrEmpty
((
string
)
element
.
Attribute
(
"StartTime"
))
?
(
DateTime
?)
null
:
XmlConvert
.
ToDateTime
((
string
)
element
.
Attribute
(
"StartTime"
),
"yyyy-MM-dd HH:mm"
),
FinishTime
=
String
.
IsNullOrEmpty
((
string
)
element
.
Attribute
(
"
Start
Time"
))
?
(
DateTime
?)
null
:
XmlConvert
.
ToDateTime
((
string
)
element
.
Attribute
(
"FinishTime"
),
"yyyy-MM-dd HH:mm"
),
FinishTime
=
String
.
IsNullOrEmpty
((
string
)
element
.
Attribute
(
"
Finish
Time"
))
?
(
DateTime
?)
null
:
XmlConvert
.
ToDateTime
((
string
)
element
.
Attribute
(
"FinishTime"
),
"yyyy-MM-dd HH:mm"
),
}).
ToList
();
return
result
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment