Skip to content

Commit

Permalink
fix build job query
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetretto committed Sep 13, 2024
1 parent 94230ef commit 496e9b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 4 additions & 3 deletions doc/source/user/tuning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ to set the values of the resources and execution configurations.

.. note::

In order for this to be meaningful only Jobs that have not been started
can be modified. So this commands can be applied only to Jobs in the
``READY`` or ``WAITING`` states.
In order for this to be meaningful only a subset of Jobs states are
acceptable. This commands can be applied only to Jobs in the
``READY``, ``WAITING``, ``COMPLETED``, ``FAILED``, ``PAUSED`` and
``REMOTE_ERROR`` states.
5 changes: 2 additions & 3 deletions src/jobflow_remote/jobs/jobcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def _build_query_job(
if isinstance(workers, str):
workers = [workers]

query: dict = {}
query: dict = defaultdict(dict)

if db_ids:
query["db_id"] = {"$in": db_ids}
Expand All @@ -255,7 +255,7 @@ def _build_query_job(
query["updated_on"] = {"$gte": start_date_str}
if end_date:
end_date_str = end_date.astimezone(timezone.utc)
query["updated_on"] = {"$lte": end_date_str}
query["updated_on"]["$lte"] = end_date_str

if locked:
query["lock_id"] = {"$ne": None}
Expand All @@ -269,7 +269,6 @@ def _build_query_job(
if metadata:
metadata_dict = {f"job.metadata.{k}": v for k, v in metadata.items()}
query.update(metadata_dict)
print(query)

if workers:
query["worker"] = {"$in": workers}
Expand Down

0 comments on commit 496e9b0

Please sign in to comment.