Skip to content

Commit a78704a

Browse files
committed
first draft
1 parent b71370b commit a78704a

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

BRB/run.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,21 @@
2727
help='specify a custom ini file.',
2828
show_default=True
2929
)
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):
3137

3238
while True:
33-
#Read the config file
39+
# Read the config file
3440
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
3743
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:
3945
sleep(60*60)
4046
continue
4147

@@ -47,7 +53,17 @@ def run_brb(configfile):
4753
print(f"Logging into: {logFile}")
4854
setLog(logFile)
4955

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
5167
bdir = "{}/{}".format(config.get('Paths', 'baseData'), config.get('Options', 'runID'))
5268
msg = []
5369
for k, v in ParkourDict.items():
@@ -62,11 +78,14 @@ def run_brb(configfile):
6278
print("Received an error running PushButton.GetResults() with {} and {}".format(k, v), file=sys.stderr)
6379
raise
6480

65-
#Email finished message
81+
# Email finished message
6682
log.info('Create e-mail')
6783
log.info(msg)
6884
BRB.email.finishedEmail(config, msg)
6985

70-
#Mark the flow cell as having been processed
86+
# Mark the flow cell as having been processed
7187
BRB.findFinishedFlowCells.markFinished(config)
7288
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

Comments
 (0)