-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add all expid_dir_path functions to autosubmit.py, add attached files to emails #1997
base: master
Are you sure you want to change the base?
Conversation
In GitLab by @isimo00 on Nov 5, 2024, 12:27 requested review from @dbeltrankyl and removed review request for @kinow |
In GitLab by @isimo00 on Nov 5, 2024, 12:49 mentioned in commit 4eec259671daf0dcadb2454ac58c7a91dd9b5afe |
In GitLab by @isimo00 on Nov 5, 2024, 12:49 added 9 commits
|
In GitLab by @dbeltrankyl on Nov 5, 2024, 12:54 Commented on autosubmit/notifications/mail_notifier.py line 76 Hello @isimo00, Thanks for working on it! I think it should point directly to the exact err and exact out instead of the folder. Maybe.. we can attach the logs in the mail itself? and/or point to the specific log in GUI? As it can be easily read ( the latter, not sure how to do it without hardcore it FYI @LuiggiTenorioK ) what do you think? |
In GitLab by @isimo00 on Nov 5, 2024, 12:58 marked the checklist item Resolve merging conflicts as completed |
In GitLab by @dbeltrankyl on Nov 5, 2024, 12:58 Commented on test/unit/conftest.py line 68 Hello, Why the change of Maybe we can use Path().joinpath() if you find that FYI @kinow |
In GitLab by @dbeltrankyl on Nov 5, 2024, 12:58 Commented on test/unit/conftest.py line 68 In general, I think that @kinow recommended using Path for all ( per example, os.path.exists -> Path().exists() ) , os.makedirs -> Path().mkdir(Parents=True,exists_ok=True) ( didn't double check the syntax) ) edit: There are other similar cases across the changes |
In GitLab by @dbeltrankyl on Nov 5, 2024, 13:04 Commented on test/unit/conftest.py line 197 Can we use the mocker fixture there? Instead of using
|
In GitLab by @isimo00 on Nov 5, 2024, 13:04 Commented on test/unit/conftest.py line 68 The functions added here (e.g. aslogs_dir = BasicConfig.aslog_dir_mock(expid) in line 50) return |
In GitLab by @dbeltrankyl on Nov 5, 2024, 13:06 Thanks @isimo00! I comment in one stuff to change ( maybe) and commented on some stuff about the tests. I think we should agree on what to use for the Paths with @kinow , @LuiggiTenorioK mainly to normalize the code |
In GitLab by @isimo00 on Nov 5, 2024, 13:06 Commented on autosubmit/notifications/mail_notifier.py line 76 You mean adding/pasting the content of the log files in the mail? |
In GitLab by @dbeltrankyl on Nov 5, 2024, 13:15 Commented on autosubmit/notifications/mail_notifier.py line 76 I mean:
|
In GitLab by @LuiggiTenorioK on Nov 5, 2024, 13:34 Commented on autosubmit/notifications/mail_notifier.py line 76
The GUI shows the latest |
In GitLab by @LuiggiTenorioK on Nov 5, 2024, 13:38
Agree that using |
In GitLab by @isimo00 on Nov 5, 2024, 14:35 Started switching back to |
In GitLab by @isimo00 on Nov 5, 2024, 15:33 mentioned in commit 867e93ff52b3583772ea6e97371c5dabf5619ea0 |
In GitLab by @isimo00 on Nov 5, 2024, 15:33 added 1 commit
|
In GitLab by @isimo00 on Nov 5, 2024, 15:47 Commented on test/unit/conftest.py line 197 changed this line in version 4 of the diff |
In GitLab by @isimo00 on Nov 5, 2024, 15:47 added 1 commit
|
In GitLab by @isimo00 on Nov 5, 2024, 15:55 Commented on test/unit/conftest.py line 68 changed this line in version 5 of the diff |
In GitLab by @isimo00 on Nov 5, 2024, 15:55 added 1 commit
|
In GitLab by @kinow on Nov 6, 2024, 10:13 Commented on autosubmit/notifications/mail_notifier.py line 76 Not reviewing this one, just going through inbox emails... but maybe we could use a single f-string multiline text without concatenation? Instead of f'some string {vars} \n\n' \
+ f'another string being concatenated {vars} \n etc' I think this should work too? f'''some string {vars} \n\n
more text {vars}
etc''' |
In GitLab by @isimo00 on Nov 26, 2024, 13:18 Commented on autosubmit/notifications/mail_notifier.py line 76 changed this line in version 6 of the diff |
In GitLab by @isimo00 on Nov 26, 2024, 13:18 added 1 commit
|
In GitLab by @isimo00 on Dec 4, 2024, 11:46 added 1 commit
|
In GitLab by @isimo00 on Dec 5, 2024, 10:46 mentioned in commit df8c557e5713428f0c8e1afca942081ed958e55e |
In GitLab by @isimo00 on Dec 5, 2024, 10:46 added 1 commit
|
Maybe we can split it, and leave the pathlib/os.path/BasicConfig changes in the other PR... then this one just adds the email thingy. |
@kinow For some reason I can't tag you as a reviewer, but this is finally done now! |
It's because I'm the creator of this pull request (due to how the migration script works -- it uses the migration user in the GitHub API calls, as owner). |
Ah I see. Well @kinow , let me know if you think something else is missing / you can't review it or I can tag Luiggi :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isimo00 reviewed most of the changes, pending just mail_notifier.py
now (:coffee: break)
|
||
class MailNotifier: | ||
def __init__(self, basic_config): | ||
self.config = basic_config | ||
|
||
def notify_experiment_status(self, exp_id,mail_to,platform): | ||
message_text = self._generate_message_experiment_status(exp_id, platform) | ||
message = MIMEText(message_text) | ||
message = MIMEMultipart() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to confirm if this is the best option. I remember the discussion, but I didn't have time to ponder about it, sorry.
@mcastril, here we have a few options, basically,
- we send a notification as we already do, but include the location of the logs in the VM/hub/somewhere
- we attach the complete log as-is into the email body
- we compress and then attach the logs (and delete the compressed archive as the original logs will remain anyway) into the email body
I think I am more included towards 1) to simplify or a 1.5) option, where we let users choose whether they want the location or the attachment, but I had seen a comment about doing the option 2), which is implemented here.
WDYT, Miguel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isimo00 from today's AS meeting:
- Let's compress the file by default
- We don't have to worry about extremely large files as we are only attaching _run logs (shouldn't be in the GB, mayyyybe MB, more likely b/kb)
- I will create separate issues for toggle/flags that disable attachment or restrict the attachment size 👍
So if you add the compression here by default, we can review & merge it :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to 4.1.13 backlog, #2050
Thank you for the extensive review @kinow! I've taken it as a sign to finally start using |
I think Luiggi is using Ruff. In the end, these tools in Python tend to follow more or less the same set of rules, based on pep8 (normally pep8 is a subset of all lint rules, as these tools add more on top of it). So that's a good start! But maybe check with Luiggi if it would be better if you used ruff too. This is up to discussion too, but ruff is also used in other BSC projects (and DestinE workflow, GSV, etc.) so there is a good case for us to use that too. And thank you for the great PR with tests, and for splitting the change in the pathlib that would require more test coverage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finished reviewing it, @isimo00 . I think we can wait for others (especially Miguel) to have time to review the part about attaching logs to the email body. But otherwise the code looks good to me. I added a couple of comments now after reading it one last time. The part about BaseException
was already in the code, but maybe we can improve it here. Thanks!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that too and undid the rebase, thanks @kinow ! |
Great! @LuiggiTenorioK merged the PR that fixes the rocrate tests. I think if you rebase it (assuming your rebase was done earlier) that should fix the build here 🤞 |
All previous definitions all expid_path, tmp_path, log_path and aslogs_path (and similar) have been removed and their calls have been switched for BasicConfig.foo() calls. Impacted tests are mainly affected in terms of adding Mock objects since BasicConfig.foo() functions are not available in autosubmitconfigparser yet. No new tests added
@kinow I believe this is ready to merge, if you'd like to do a final revision I'll be checking the issue for further comments |
In GitLab by @isimo00 on Nov 5, 2024, 12:27
All previous definitions all
expid_path
,tmp_path
,log_path
andaslogs_path
(and similar) have been removed and their calls have been switched forBasicConfig.foo()
calls. Impacted tests are mainly affected in terms of adding Mock objects sinceBasicConfig.foo()
functions are not available in autosubmitconfigparser yet. No new tests added.