2
2
3
3
import lombok .Getter ;
4
4
import org .apache .commons .lang3 .StringUtils ;
5
+ import org .apache .logging .log4j .Logger ;
5
6
import org .jetbrains .annotations .NotNull ;
7
+ import org .json .JSONObject ;
6
8
import org .labkey .api .data .Container ;
7
9
import org .labkey .api .files .FileContentService ;
8
10
import org .labkey .api .pipeline .ParamParser ;
9
11
import org .labkey .api .pipeline .PipeRoot ;
10
12
import org .labkey .api .pipeline .PipelineJobService ;
13
+ import org .labkey .api .pipeline .PipelineService ;
14
+ import org .labkey .api .pipeline .PipelineStatusFile ;
11
15
import org .labkey .api .pipeline .TaskId ;
12
16
import org .labkey .api .pipeline .TaskPipeline ;
13
17
import org .labkey .api .pipeline .file .AbstractFileAnalysisJob ;
14
18
import org .labkey .api .util .FileUtil ;
15
19
import org .labkey .api .util .PageFlowUtil ;
20
+ import org .labkey .api .util .StringUtilsLabKey ;
21
+ import org .labkey .api .util .logging .LogHelper ;
16
22
import org .labkey .api .view .ViewBackgroundInfo ;
17
23
18
24
import java .io .BufferedWriter ;
26
32
@ Getter
27
33
public class NextFlowPipelineJob extends AbstractFileAnalysisJob
28
34
{
35
+ protected static final Logger LOG = LogHelper .getLogger (NextFlowPipelineJob .class , "NextFlow jobs" );
36
+
29
37
private Path config ;
30
38
31
39
@ SuppressWarnings ("unused" ) // For serialization
@@ -51,6 +59,24 @@ public NextFlowPipelineJob(ViewBackgroundInfo info, @NotNull PipeRoot root, Path
51
59
super (new NextFlowProtocol (), NextFlowPipelineProvider .NAME , info , root , config .getFileName ().toString (), config , inputFiles , false , false );
52
60
this .config = config ;
53
61
setLogFile (log );
62
+ LOG .info ("NextFlow job queued: {}" , getJsonJobInfo ());
63
+ }
64
+
65
+ protected JSONObject getJsonJobInfo ()
66
+ {
67
+ JSONObject result = new JSONObject ();
68
+ result .put ("user" , getUser ().getEmail ());
69
+ result .put ("container" , getContainer ().getPath ());
70
+ result .put ("filePath" , getLogFilePath ().getParent ().toString ());
71
+ result .put ("runName" , getNextFlowRunName ());
72
+ result .put ("configFile" , getConfig ().getFileName ().toString ());
73
+ return result ;
74
+ }
75
+
76
+ protected String getNextFlowRunName ()
77
+ {
78
+ PipelineStatusFile file = PipelineService .get ().getStatusFile (getJobGUID ());
79
+ return file == null ? "Unknown" : ("LabKeyJob" + file .getRowId ());
54
80
}
55
81
56
82
@ Override
@@ -87,7 +113,7 @@ private static Path createConfig(Path configTemplate, Path parentDir, Path jobDi
87
113
@ Override
88
114
public String getDescription ()
89
115
{
90
- return "NextFlow analysis using " + config . getFileName () + " of " + getInputFilePaths (). size () + " files" ;
116
+ return "NextFlow analysis of " + StringUtilsLabKey . pluralize ( getInputFilePaths (). size (), "file" ) + " using config: " + config . getFileName () ;
91
117
}
92
118
93
119
@ Override
0 commit comments