Skip to content

Commit

Permalink
Remove field "user" from job schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
notoraptor committed Jul 15, 2024
1 parent 7ab61e7 commit 6fa5195
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 222 deletions.
2 changes: 1 addition & 1 deletion clockwork_web/browser_routes/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def route_one():
because we had troubles using the templates correctly with dicts.
Besides, it's unclear what we're supposed to do with the extra
"cw" and "user" fields when it comes to displaying them as html.
"cw" fields when it comes to displaying them as html.
See CW-82.
.. :quickref: list one Slurm job as formatted html
Expand Down
2 changes: 1 addition & 1 deletion clockwork_web_test/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_insert_and_retrieve(app):
mc["jobs"].delete_many({"slurm.job_id": job_id, "slurm.cluster_name": "mila"})

mc["jobs"].insert_one(
{"slurm": {"cluster_name": "mila", "job_id": job_id}, "cw": {}, "user": {}}
{"slurm": {"cluster_name": "mila", "job_id": job_id}, "cw": {}}
)
L = list(
mc["jobs"].find({"slurm.job_id": job_id, "slurm.cluster_name": "mila"})
Expand Down
6 changes: 1 addition & 5 deletions docs/clockwork_dev_guide/slurm_state.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ Job and node entries both contain a "slurm" component based
on the data that we read from Slurm.
They also contain a "cw" component that Clockwork uses
to store extra information.
Jobs entries have an extra "user" component that can be
modified by the owner of the job. It is a dictionary
whose keys can be set and read.

### Jobs format

Expand Down Expand Up @@ -64,8 +61,7 @@ Jobs are stored in the database in the following format:
"cc_account_username": "ccuser02",
"mila_cluster_username": null,
"mila_email_username": null
},
"user": {}
}
}
```

Expand Down
10 changes: 4 additions & 6 deletions docs/clockwork_user_guide/rest_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ jobs
"cw": {
"cc_account_username": "ccuser01",
"mila_cluster_username": null,
"mila_email_username": null},
"user": {}
"mila_email_username": null}
},
{"slurm": {}, "cw": {}, "user": {}},
{"slurm": {}, "cw": {}, "user": {}},
{"slurm": {}, "cw": {}},
{"slurm": {}, "cw": {}},
]

:query user: (optional) any of the 3 kinds of usernames
Expand Down Expand Up @@ -121,8 +120,7 @@ jobs
"cw": {
"cc_account_username": null,
"mila_cluster_username": "milauser12",
"mila_email_username": null},
"user": {}
"mila_email_username": null}
}

:query job_id: string containing the job_id as defined by Slurm
Expand Down
1 change: 0 additions & 1 deletion scripts/insert_hardcoded_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def get_jobs_hardcoded_values():
"cluster_name": "graham",
},
"cw": {"mila_email_username": None},
"user": {},
}
]

Expand Down
5 changes: 2 additions & 3 deletions slurm_state/mongo_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def fetch_slurm_report(parser, report_path):
def slurm_job_to_clockwork_job(slurm_job: dict):
"""
Takes the components returned from the slurm reports,
and turns it into a dict with 3 subcomponents.
and turns it into a dict with 2 subcomponents.
That can later be committed to mongodb in the format
that clockwork expects.
"""
Expand All @@ -55,7 +55,6 @@ def slurm_job_to_clockwork_job(slurm_job: dict):
"cw": {
"mila_email_username": None,
},
"user": {},
}
return clockwork_job

Expand Down Expand Up @@ -362,7 +361,7 @@ def get_jobs_updates_and_insertions(
# which is a thing that D_job_sc wouldn't have.

D_job_new = {}
for k in ["cw", "slurm", "user"]:
for k in ["cw", "slurm"]:
D_job_new[k] = D_job_db.get(k, {}) | D_job_sacct.get(k, {})
# Add these field each time an entry is updated
now = time.time()
Expand Down
1 change: 0 additions & 1 deletion slurm_state_test/test_mongo_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def test_slurm_job_to_clockwork_job():
"cw": {
"mila_email_username": None,
},
"user": {},
}


Expand Down
Loading

0 comments on commit 6fa5195

Please sign in to comment.