Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

push stats on demand #91

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions BRB/run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
import glob
import sys
import os
import BRB.getConfig
Expand Down Expand Up @@ -27,15 +28,21 @@
help='specify a custom ini file.',
show_default=True
)
def run_brb(configfile):
@click.option(
adRn-s marked this conversation as resolved.
Show resolved Hide resolved
"-s",
"--stats",
required=False,
help='specify a flowcell ID to push its stats.'
)
def run_brb(configfile, stats):

while True:
#Read the config file
# Read the config file
config = BRB.getConfig.getConfig(configfile)

#Get the next flow cell to process, or sleep
# Get the next flow cell to process, or sleep
config, ParkourDict = BRB.findFinishedFlowCells.newFlowCell(config)
if(config.get('Options','runID') == '') or ParkourDict is None:
if(config.get('Options','runID') == '') or ParkourDict is None or stats is None:
adRn-s marked this conversation as resolved.
Show resolved Hide resolved
sleep(60*60)
continue

Expand All @@ -47,7 +54,17 @@ def run_brb(configfile):
print(f"Logging into: {logFile}")
setLog(logFile)

#Process each group's data, ignore cases where the project isn't in the lanes being processed
# Push stats on-demand
if stats is not None:
# stats: is the FCID specified by using CLI argument
d = [d for d in glob.glob("{}/*/fastq.made".format(config.get('Paths', 'baseData'))) if stats in d]
assert len(d) == 1
config.set('Options','runID',d[1].split("/")[-2])
if not BRB.findFinishedFlowCells.flowCellProcessed(config):
print(f"Found new flow cell, this is terribly wrong: [red]{config.get("Options","runID")}[/red]")
ParkourDict = BRB.findFinishedFlowCells.queryParkour(config)

# Process each group's data, ignore cases where the project isn't in the lanes being processed
bdir = "{}/{}".format(config.get('Paths', 'baseData'), config.get('Options', 'runID'))
msg = []
for k, v in ParkourDict.items():
Expand All @@ -62,11 +79,14 @@ def run_brb(configfile):
print("Received an error running PushButton.GetResults() with {} and {}".format(k, v), file=sys.stderr)
raise

#Email finished message
# Email finished message
log.info('Create e-mail')
log.info(msg)
BRB.email.finishedEmail(config, msg)

#Mark the flow cell as having been processed
# Mark the flow cell as having been processed
BRB.findFinishedFlowCells.markFinished(config)
log.info('=== finished flowcell ===')

if stats is not None:
break # exit the main loop, don't do anything else.