Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpc-workflow-manager
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
FIJI
hpc-workflow-manager
Commits
45bd29ae
Commit
45bd29ae
authored
7 years ago
by
Petr Bainar
Browse files
Options
Downloads
Patches
Plain Diff
iss1011: implementing Task parsing from the snakeMake output
parent
775b1deb
No related branches found
No related tags found
1 merge request
!5
Iss1011
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java
+34
-24
34 additions, 24 deletions
...4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java
with
34 additions
and
24 deletions
haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/BenchmarkJobManager.java
+
34
−
24
View file @
45bd29ae
...
...
@@ -9,12 +9,14 @@ import java.nio.file.Files;
import
java.nio.file.InvalidPathException
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Collection
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Scanner
;
import
java.util.function.Predicate
;
import
java.util.stream.Collectors
;
...
...
@@ -49,13 +51,16 @@ public class BenchmarkJobManager {
public
final
class
BenchmarkJob
extends
ObservableValueBase
<
BenchmarkJob
>
implements
HaaSOutputSource
{
private
Job
job
;
private
JobState
oldState
;
private
HaaSOutputHolder
outputOfSnakemake
;
private
List
<
Task
>
tasks
;
private
SPIMComputationAccessor
computationAccessor
=
new
SPIMComputationAccessor
()
{
private
HaaSOutputHolder
outputOfSnakemake
=
new
HaaSOutputHolderImpl
(
getValue
(),
SynchronizableFileType
.
StandardErrorFile
);
@Override
public
String
getActualOutput
()
{
return
outputOfSnakemake
.
getActualOutput
();
...
...
@@ -71,7 +76,6 @@ public class BenchmarkJobManager {
public
BenchmarkJob
(
Job
job
)
{
super
();
this
.
job
=
job
;
outputOfSnakemake
=
new
HaaSOutputHolderImpl
(
getValue
(),
SynchronizableFileType
.
StandardErrorFile
);
}
public
void
startJob
(
Progress
progress
)
throws
IOException
{
...
...
@@ -98,7 +102,7 @@ public class BenchmarkJobManager {
setDownloaded
(
true
);
}
public
void
downloadStatistics
(
Progress
progress
)
throws
IOException
{
public
void
downloadStatistics
(
Progress
progress
)
throws
IOException
{
job
.
download
(
BenchmarkJobManager
.
downloadStatistics
(),
progress
);
fireValueChangedEvent
();
Path
resultFile
=
job
.
getDirectory
().
resolve
(
Constants
.
BENCHMARK_RESULT_FILE
);
...
...
@@ -171,33 +175,39 @@ public class BenchmarkJobManager {
}
public
List
<
Task
>
getTasks
()
{
if
(
tasks
==
null
)
{
if
(
tasks
==
null
)
{
fillTasks
();
}
return
tasks
;
}
}
private
void
fillTasks
()
{
SPIMComputationAccessor
accessor
=
computationAccessor
;
String
snakeMakeoutput
=
outputOfSnakemake
.
getActualOutput
();
//TASK 1011 parse snakeOutput, create tasks base part:
//Job counts:
// count jobs
// 1 define_output
// 1 define_xml_tif
// 1 done
// 2 fusion
// 1 hdf5_xml
// 1 hdf5_xml_output
// 2 registration
// 2 resave_hdf5
// 2 resave_hdf5_output
// 1 timelapse
// 1 xml_merge
// 15
final
String
OUTPUT_PARSING_JOB_COUNTS
=
"Job counts:"
;
final
String
OUTPUT_PARSING_TAB_DELIMITER
=
"\\t"
;
final
int
OUTPUT_PARSING_EXPECTED_NUMBER_OF_WORDS_PER_LINE
=
2
;
tasks
=
new
ArrayList
<>();
Scanner
scanner
=
new
Scanner
(
computationAccessor
.
getActualOutput
());
while
(
scanner
.
hasNextLine
())
{
if
(!
scanner
.
nextLine
().
equals
(
OUTPUT_PARSING_JOB_COUNTS
))
{
continue
;
}
scanner
.
nextLine
();
while
(
true
)
{
List
<
String
>
lineWords
=
Arrays
.
stream
(
scanner
.
nextLine
().
split
(
OUTPUT_PARSING_TAB_DELIMITER
))
.
filter
(
word
->
word
.
length
()
>
0
).
collect
(
Collectors
.
toList
());
if
(
lineWords
.
size
()
!=
OUTPUT_PARSING_EXPECTED_NUMBER_OF_WORDS_PER_LINE
)
{
break
;
}
tasks
.
add
(
new
Task
(
computationAccessor
,
lineWords
.
get
(
1
),
Integer
.
parseInt
(
lineWords
.
get
(
0
))));
}
break
;
}
scanner
.
close
();
}
private
void
setDownloaded
(
boolean
b
)
{
job
.
setProperty
(
JOB_HAS_DATA_TO_DOWNLOAD_PROPERTY
,
b
+
""
);
}
...
...
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