diff options
Diffstat (limited to 'python/process_queue.py')
| -rw-r--r-- | python/process_queue.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/python/process_queue.py b/python/process_queue.py index 43fb2c67..33c229e7 100644 --- a/python/process_queue.py +++ b/python/process_queue.py @@ -349,12 +349,13 @@ def process_list( dest = get_filepath(DAILY_DIR, trade_type, fund) if upload: upload_buf(buf, dest.name, fund) + dest.parent.mkdir(exist_ok=True) dest.write_bytes(buf) p.delete(key) def terminate_list( - p: redis.client.Pipeline, key: str, upload: bool, base_dir: pathlib.Path + p: redis.client.Pipeline, key: str, upload: bool, base_dir: pathlib.Path = DAILY_DIR ) -> None: trade_type = key.split("_")[0] for term in p.lrange(key, 0, -1): @@ -368,8 +369,8 @@ def terminate_list( dest = get_filepath(base_dir, trade_type, termination["fund"]) if upload: upload_buf(buf, dest.name) - dest.parent.mkdir(exists_ok=True) - dest.write_bytes(buf) + dest.parent.mkdir(exist_ok=True) + dest.write_bytes(buf) p.delete(key) @@ -1040,8 +1041,6 @@ if __name__ == "__main__": r.transaction(p_list, key) for trade_type in ("cds", "swaption", "capfloor"): key = f"{trade_type}_termination" - t_list = partial( - terminate_list, key=key, upload=not args.no_upload, base_dir=DAILY_DIR - ) + t_list = partial(terminate_list, key=key, upload=not args.no_upload) r.transaction(t_list, key) dawndb.close() |
