27
27
help = 'specify a custom ini file.' ,
28
28
show_default = True
29
29
)
30
- def run_brb (configfile ):
30
+ @click .option (
31
+ "-s" ,
32
+ "--stats" ,
33
+ required = False ,
34
+ help = 'specify a flowcell ID to push its stats.'
35
+ )
36
+ def run_brb (configfile , stats ):
31
37
32
38
while True :
33
- #Read the config file
39
+ # Read the config file
34
40
config = BRB .getConfig .getConfig (configfile )
35
-
36
- #Get the next flow cell to process, or sleep
41
+
42
+ # Get the next flow cell to process, or sleep
37
43
config , ParkourDict = BRB .findFinishedFlowCells .newFlowCell (config )
38
- if (config .get ('Options' ,'runID' ) == '' ) or ParkourDict is None :
44
+ if (config .get ('Options' ,'runID' ) == '' ) or ParkourDict is None or stats is None :
39
45
sleep (60 * 60 )
40
46
continue
41
47
@@ -47,7 +53,17 @@ def run_brb(configfile):
47
53
print (f"Logging into: { logFile } " )
48
54
setLog (logFile )
49
55
50
- #Process each group's data, ignore cases where the project isn't in the lanes being processed
56
+ # Push stats on-demand
57
+ if not stats is None :
58
+ # stats: is the FCID specified by using CLI argument
59
+ d = [d for d in glob .glob ("{}/*/fastq.made" .format (config .get ('Paths' , 'baseData' ))) if stats in d ]
60
+ assert len (d ) == 1
61
+ config .set ('Options' ,'runID' ,d [1 ].split ("/" )[- 2 ])
62
+ if not flowCellProcessed (config ):
63
+ print (f"Found new flow cell, this is terribly wrong: [red]{ config .get ("Options" ,"runID" )} [/red]" )
64
+ ParkourDict = queryParkour (config )
65
+
66
+ # Process each group's data, ignore cases where the project isn't in the lanes being processed
51
67
bdir = "{}/{}" .format (config .get ('Paths' , 'baseData' ), config .get ('Options' , 'runID' ))
52
68
msg = []
53
69
for k , v in ParkourDict .items ():
@@ -62,11 +78,14 @@ def run_brb(configfile):
62
78
print ("Received an error running PushButton.GetResults() with {} and {}" .format (k , v ), file = sys .stderr )
63
79
raise
64
80
65
- #Email finished message
81
+ # Email finished message
66
82
log .info ('Create e-mail' )
67
83
log .info (msg )
68
84
BRB .email .finishedEmail (config , msg )
69
85
70
- #Mark the flow cell as having been processed
86
+ # Mark the flow cell as having been processed
71
87
BRB .findFinishedFlowCells .markFinished (config )
72
88
log .info ('=== finished flowcell ===' )
89
+
90
+ if not stats is None :
91
+ break # exit the main loop, don't do anything else.
0 commit comments