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

Change id field passed to JobInfo from int to str #30

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion aiida_hyperqueue/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ def _parse_joblist_output(self, retval: int, stdout: str, stderr: str) -> list:
job_info_list = []
for hq_job_dict in hq_job_info_list:
job_info = JobInfo()
job_info.job_id = hq_job_dict["id"]
job_info.job_id = str(
Copy link
Member Author

Choose a reason for hiding this comment

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

This bug cost me couple of hours to locate it. Maybe in the aiida-core it can provide type check to avoid scheduler passing wrong datatype? @sphuber

Copy link

Choose a reason for hiding this comment

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

The JobInfo is part of the many data classes that are used that are defined as the custom DefaultFieldsAttributeDict. They really should be replaced with a dataclass but not sure about backwards compatibility. Also not sure there is much we can do about this now as long as it remains a DefaultFieldsAttributeDict.

That being said, how exactly did this bug manifest? I think it should automatically be cast into str somewhere. If not, it might just be a bug in aiida-core.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @sphuber I dig a bit more into source of the issue (aiidateam/aiida-core#6542), but didn't able to find a good solution.

hq_job_dict["id"]
) # must be str, if it is a int job will not waiting
job_info.title = hq_job_dict["name"]
stats: t.List[str] = [
stat for stat, v in hq_job_dict["task_stats"].items() if v > 0
Expand Down
Loading