Skip to content

Commit

Permalink
Export dir as envvar
Browse files Browse the repository at this point in the history
  • Loading branch information
finngl committed Nov 28, 2023
1 parent 31d9bf3 commit 8cb66b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bifrost_chewbbaca/run_standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ def run_pipeline(self):


if __name__ == '__main__':
assert os.path.exists('~/mongoexports')
export_dir = pathlib.Path(os.environ["MONGOEXPORT_DIR"])
assert export_dir.exists()
start_time = datetime.now()
instance = BifrostchewBBACA()
instance.run_pipeline()
Expand All @@ -108,9 +109,10 @@ def run_pipeline(self):
print(f"Run took {run_time.seconds} seconds")
print("Will now run mongoexport")
export_filename = now.isoformat(timespec='seconds').replace(':', '') + '.json'
path = f"~/mongoexports/{export_filename}"
export_filepath = pathlib.Path(export_dir, export_filename)
print(f"Export will be saved in {export_filepath}")
command = \
f"mongoexport --db bifrost_test_db --collection samples --pretty --out {path}"
f"mongoexport --db bifrost_test_db --collection samples --pretty --out {str(export_filepath)}"
process: subprocess.Popen = subprocess.Popen(
command, stdout=sys.stdout, stderr=sys.stderr, shell=True
)
Expand Down

0 comments on commit 8cb66b4

Please sign in to comment.