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

notify_on normalized #58

Merged
merged 2 commits into from
Dec 16, 2024
Merged

notify_on normalized #58

merged 2 commits into from
Dec 16, 2024

Conversation

dbeltrankyl
Copy link
Contributor

Associated with https://earth.bsc.es/gitlab/es/autosubmit/-/merge_requests/532

This normalizes the job.notify_on value to a list

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.30%. Comparing base (1bb4631) to head (e5804ca).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #58      +/-   ##
==========================================
+ Coverage   45.97%   46.30%   +0.33%     
==========================================
  Files           3        3              
  Lines        1601     1611      +10     
  Branches      410      413       +3     
==========================================
+ Hits          736      746      +10     
  Misses        790      790              
  Partials       75       75              
Flag Coverage Δ
fast-tests 46.30% <100.00%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 560 to 567
if "NOTIFY_ON" in data_fixed["JOBS"][job_section]:
if type(data_fixed["JOBS"][job_section]["NOTIFY_ON"]) is str:
if "," in data_fixed["JOBS"][job_section]["NOTIFY_ON"]:
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"].split(",")]
else:
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"].split()]
else:
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"]]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if "NOTIFY_ON" in data_fixed["JOBS"][job_section]:
if type(data_fixed["JOBS"][job_section]["NOTIFY_ON"]) is str:
if "," in data_fixed["JOBS"][job_section]["NOTIFY_ON"]:
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"].split(",")]
else:
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"].split()]
else:
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"]]
notify_on = data_fixed["JOBS"][job_section].get("NOTIFY_ON", "")
if notify_on:
if type(notify_on) is str:
if "," in notify_on:
notify_on = notify_on.split(",")
else:
notify_on = notify_on.split()
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in notify_on]

I think the test should pass with this one too. The previous code has 166 lines of bytecode on godbolt, while the alternative has 78 lines. But I think it doesn't matter unless this function is called a lot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks added! Merging...

@dbeltrankyl dbeltrankyl merged commit 3685a43 into main Dec 16, 2024
1 check passed
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