Skip to content

Commit

Permalink
fix db_id in output's metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetretto committed Dec 12, 2023
1 parent 1a664cc commit 74507b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/jobflow_remote/jobs/jobcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2611,7 +2611,7 @@ def complete_job(

remote_store = get_remote_store(store, local_path)
remote_store.connect()
update_store(store, remote_store, save)
update_store(store, remote_store, save, job_doc.db_id)
self.checkin_job(
job_doc,
flow_lock.locked_document,
Expand Down
4 changes: 0 additions & 4 deletions src/jobflow_remote/jobs/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,6 @@ def upload(self, lock):
except Exception:
logging.error(f"error while closing the store {store}", exc_info=True)

# set the db_id in the job's metadata, so that it is available in the outputs
if "db_id" not in job.metadata:
job.metadata["db_id"] = db_id

remote_path = get_job_path(job.uuid, job.index, worker.work_dir)

# Set the value of the original store for dynamical workflow. Usually it
Expand Down
7 changes: 6 additions & 1 deletion src/jobflow_remote/remote/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,17 @@ def get_remote_store_filenames(store: JobStore) -> list[str]:
return filenames


def update_store(store, remote_store, save):
def update_store(store, remote_store, save, db_id):
# TODO is it correct?
data = list(remote_store.query(load=save))
if len(data) > 1:
raise RuntimeError("something wrong with the remote store")

# Set the db_id here and not directly in the Job's metadata to avoid
# that it gets passed down to its children/replacements.
if "db_id" not in data[0]["metadata"]:
data[0]["metadata"]["db_id"] = db_id

store.connect()
try:
for d in data:
Expand Down

0 comments on commit 74507b7

Please sign in to comment.