Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sarc 229 - Add function load_job_series() #89

Merged
merged 29 commits into from
Nov 30, 2023
Merged

Sarc 229 - Add function load_job_series() #89

merged 29 commits into from
Nov 30, 2023

Conversation

notoraptor
Copy link
Contributor

Hello @bouthilx @nurbal ! This is a PR for SARC-229 !

sarc/jobs/series.py Outdated Show resolved Hide resolved
sarc/jobs/series.py Outdated Show resolved Hide resolved
sarc/jobs/series.py Outdated Show resolved Hide resolved
sarc/jobs/series.py Outdated Show resolved Hide resolved
job_series["cpu"] = (
max(billing, job.allocated.cpu) if job.allocated.cpu else 0
)
job_series["gpu_requested"] = gres_gpu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is a bug here (probably coming from my initial example, sorry!). It should be job.requested.gres_gpu.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I change billing too ? https://github.com/mila-iqia/SARC/blob/sarc-229/sarc/jobs/series.py#L310

        billing = job.allocated.billing or 0
        gres_gpu = job.allocated.gres_gpu or 0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, for billing it's the allocated values. That's good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK ! Done: 6e0d8f2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups, je voulais dire que c'était correct, faut laisser comme c'était. 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actuellement, c'est comme ceci;

        billing = job.allocated.billing or 0
        gres_gpu = job.requested.gres_gpu or 0

Que faut-il changer ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mise à jour dans le dernier commit: 2f60e3a

sarc/jobs/series.py Outdated Show resolved Hide resolved
notoraptor and others added 2 commits November 23, 2023 12:06
Co-authored-by: Xavier Bouthillier <[email protected]>
Co-authored-by: Xavier Bouthillier <[email protected]>
sarc/jobs/series.py Outdated Show resolved Hide resolved
max(billing, job.allocated.cpu) if job.allocated.cpu else 0
)
job_series["gpu_requested"] = gres_gpu
job_series["duration"] = job.elapsed_time
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also is not necessary in the end. Leftover of my exemple, sorry. 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for mem below actually.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, mem also removed: bd317ed

NB: About mem, it was copied from job.allocated.mem. I just remarked that job.allocated is copied as a dict inside data frame, so someone who wants to just get the mem value will have to do something like frame['allocated'][row]['mem']. It is ok ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non en effet, je viens de réaliser ça: bd317ed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Et dans le fond, quand on aura allocated et requested en versions flattened, on aura les champs {requested,allocated}_gpu.

Ce serait peut-être bien dans ce cas qu'on utilise le même format, c'est à dire requested_gpu par exemple. C'est quand même utile quand fasse l'opération qu'on fait là, sinon billing est difficile à utiliser dans un dataframe. La raison pour laquelle on a le if-else, c'est que billing s'applique à allocated_gpu si c'est une job avec GPU, sinon c'est à allocated_cpu.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mis à jour dans le dernier commit! 2f60e3a

@pytest.mark.usefixtures("read_only_db", "tzlocal_is_mtl")
@pytest.mark.parametrize("params", few_parameters.values(), ids=few_parameters.keys())
def test_load_job_series_fields_list(params, file_regression):
fields = ["gpu_memory", "user", "work_dir"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faudrait garder la mem mais avec le nouveau nom. D'après la liste ALL_COLUMNS je crois comprendre que allocated et requested ne sont pas flattened comme je l'aurais pensé. Faudrait par exemple que les attributes de allocated apparaissent tel que allocated.<nomdelattribut>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok ! Fait dans le dernier commit: 2f60e3a

sarc/jobs/series.py Outdated Show resolved Hide resolved
sarc/jobs/series.py Outdated Show resolved Hide resolved
Copy link
Member

@bouthilx bouthilx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est bon, merci beaucoup!

@bouthilx bouthilx merged commit ed59d20 into master Nov 30, 2023
7 checks passed
@notoraptor notoraptor deleted the sarc-229 branch December 4, 2023 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants