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
48a79a0b
Commit
48a79a0b
authored
7 years ago
by
Petr Bainar
Browse files
Options
Downloads
Patches
Plain Diff
iss1011: resolving of TaskComputation inputs, outputs and logs
parent
1928b9d7
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/TaskComputation.java
+51
-22
51 additions, 22 deletions
...z/it4i/fiji/haas_spim_benchmark/core/TaskComputation.java
with
51 additions
and
22 deletions
haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/core/TaskComputation.java
+
51
−
22
View file @
48a79a0b
package
cz.it4i.fiji.haas_spim_benchmark.core
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.LinkedList
;
import
java.util.Scanner
;
...
...
@@ -7,25 +8,40 @@ import java.util.Scanner;
import
cz.it4i.fiji.haas_java_client.JobState
;
public
class
TaskComputation
{
// A single-purpose class dedicated to help with TaskComputation members initialization
private
class
ParsedTaskComputationValues
{
private
final
Collection
<
String
>
logs
;
private
final
Collection
<
String
>
inputs
;
private
final
Collection
<
String
>
outputs
;
private
final
Long
id
;
public
ParsedTaskComputationValues
(
Collection
<
String
>
inputs
,
Collection
<
String
>
outputs
,
Collection
<
String
>
logs
,
Long
id
)
{
this
.
inputs
=
inputs
;
this
.
outputs
=
outputs
;
this
.
logs
=
logs
;
this
.
id
=
id
;
}
}
private
final
SPIMComputationAccessor
outputHolder
;
private
final
Task
task
;
private
final
int
timepoint
;
private
final
Collection
<
String
>
inputs
;
private
final
Collection
<
String
>
outputs
;
private
final
Collection
<
String
>
logs
;
private
final
Long
id
;
//TASK 1011 what states will be defined and how it will be defined
private
JobState
state
=
JobState
.
Unknown
;
private
Collection
<
String
>
logs
=
new
LinkedList
<>();
private
Collection
<
String
>
outputs
=
new
LinkedList
<>();
private
Collection
<
String
>
inputs
=
new
LinkedList
<>();
public
TaskComputation
(
SPIMComputationAccessor
outputHolder
,
Task
task
,
int
timepoint
)
{
this
.
outputHolder
=
outputHolder
;
this
.
task
=
task
;
this
.
timepoint
=
timepoint
;
this
.
id
=
resolveId
();
this
.
timepoint
=
timepoint
;
ParsedTaskComputationValues
parsedValues
=
parseStuff
(
outputHolder
);
this
.
inputs
=
parsedValues
.
inputs
;
this
.
outputs
=
parsedValues
.
outputs
;
this
.
logs
=
parsedValues
.
logs
;
this
.
id
=
parsedValues
.
id
;
}
public
JobState
getState
()
{
...
...
@@ -39,7 +55,7 @@ public class TaskComputation {
return
;
}
String
snakeOutput
=
outputHolder
.
getActualOutput
();
//
String snakeOutput = outputHolder.getActualOutput();
//TASK 1011
//resolve if job is queued (defined id), started (exists log file), finished (in log is Finished job 10.) or
...
...
@@ -50,34 +66,47 @@ public class TaskComputation {
return
id
;
}
private
Long
resolveId
(
)
{
private
ParsedTaskComputationValues
parseStuff
(
SPIMComputationAccessor
outputHolder
)
{
final
String
OUTPUT_PARSING_RULE
=
"rule "
;
final
String
OUTPUT_PARSING_JOB_ID
=
"jobid: "
;
final
String
OUTPUT_PARSING_COLON
=
":"
;
final
String
OUTPUT_PARSING_COMMA_SPACE
=
", "
;
final
String
desiredPattern
=
OUTPUT_PARSING_RULE
+
task
.
getDescription
()
+
OUTPUT_PARSING_COLON
;
final
String
OUTPUT_PARSING_INPUTS
=
"input: "
;
final
String
OUTPUT_PARSING_OUTPUTS
=
"output: "
;
final
String
OUTPUT_PARSING_LOGS
=
"log: "
;
final
String
OUTPUT_PARSING_JOB_ID
=
"jobid: "
;
Scanner
scanner
=
new
Scanner
(
outputHolder
.
getActualOutput
());
int
jobsToSkip
=
timepoint
-
1
;
do
{
int
jobsToSkip
=
timepoint
;
while
(
scanner
.
hasNextLine
()
&&
jobsToSkip
>
0
)
{
if
(
scanner
.
nextLine
().
equals
(
desiredPattern
))
{
jobsToSkip
--;
}
}
while
(
jobsToSkip
>=
0
&&
scanner
.
hasNextLine
());
}
String
currentLine
;
Collection
<
String
>
resolvedInputs
=
new
LinkedList
<>();
Collection
<
String
>
resolvedOutputs
=
new
LinkedList
<>();
Collection
<
String
>
resolvedLogs
=
new
LinkedList
<>();
Long
resolvedId
=
null
;
while
(
scanner
.
hasNextLine
())
{
currentLine
=
scanner
.
nextLine
();
if
(!
currentLine
.
contains
(
OUTPUT_PARSING_JOB_ID
))
{
continue
;
if
(
currentLine
.
contains
(
OUTPUT_PARSING_INPUTS
))
{
resolvedInputs
=
Arrays
.
asList
(
currentLine
.
split
(
OUTPUT_PARSING_INPUTS
)[
1
].
split
(
OUTPUT_PARSING_COMMA_SPACE
));
}
else
if
(
currentLine
.
contains
(
OUTPUT_PARSING_OUTPUTS
))
{
resolvedOutputs
=
Arrays
.
asList
(
currentLine
.
split
(
OUTPUT_PARSING_OUTPUTS
)[
1
].
split
(
OUTPUT_PARSING_COMMA_SPACE
));
}
else
if
(
currentLine
.
contains
(
OUTPUT_PARSING_LOGS
))
{
resolvedLogs
=
Arrays
.
asList
(
currentLine
.
split
(
OUTPUT_PARSING_LOGS
)[
1
].
split
(
OUTPUT_PARSING_COMMA_SPACE
));
}
else
if
(
currentLine
.
contains
(
OUTPUT_PARSING_JOB_ID
))
{
resolvedId
=
Long
.
parseLong
(
currentLine
.
split
(
OUTPUT_PARSING_JOB_ID
)[
1
]);
}
else
if
(
currentLine
.
trim
().
isEmpty
())
{
break
;
}
resolvedId
=
Long
.
parseLong
(
currentLine
.
split
(
OUTPUT_PARSING_JOB_ID
)[
1
]);
break
;
}
scanner
.
close
();
return
resolvedId
;
}
return
new
ParsedTaskComputationValues
(
resolvedInputs
,
resolvedOutputs
,
resolvedLogs
,
resolvedId
);
}
}
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