-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a helper script to submit a single experiment
- Loading branch information
Showing
3 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
import sys | ||
import os | ||
from contextlib import contextmanager | ||
|
||
import luigi | ||
|
||
from rnaseq_pipeline.tasks import SubmitExperimentToGemma | ||
|
||
@contextmanager | ||
def umask(umask): | ||
print(f'Setting umask to 0x{umask:03o}') | ||
prev_umask = os.umask(umask) | ||
try: | ||
yield None | ||
finally: | ||
print(f'Restoring umask to 0x{prev_umask:03o}') | ||
os.umask(prev_umask) | ||
|
||
def parse_octal(s): | ||
return int(s, 8) | ||
|
||
def main(argv): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--experiment-id', required=True, help='Experiment ID to submit to Gemma') | ||
parser.add_argument('--resubmit-batch-info', action='store_false', help='Only resubmit batch information') | ||
parser.add_argument('--umask', type=parse_octal, default='002', help='Set a umask (defaults to 002 to make created files group-writable)') | ||
parser.add_argument('--workers', type=int, default=100, help='Number of workers to use (defaults to 100)') | ||
args = parser.parse_args(argv) | ||
with umask(args.umask): | ||
if args.batch_info: | ||
task = SubmitExperimentBatchInfoToGemma(experiment_id=args.experiment_id, rerun=True) | ||
else: | ||
task = SubmitExperimentToGemma(experiment_id=args.experiment_id) | ||
results = luigi.build([task], workers=args.workers, detailed_summary=True) | ||
print(results.summary_text) | ||
|
||
if __name__ == '__main__': | ||
sys.exit(main(sys.argv[1:])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters