-
Notifications
You must be signed in to change notification settings - Fork 1
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
Enduring flow refactor #68
base: main
Are you sure you want to change the base?
Conversation
* Split email config parsing into general and plover info * Add mcms service * Update config.json
try: | ||
runsCache = dbObject.watchDirectories(localInfo["watchfilepath"], inOutMap) | ||
except KeyboardInterrupt as error: |
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.
This never made sense. This is only for physical intervention which probably never happens unless someone just wants to stop the program and not just to stop this current sync of folders.
status = "STARTED" | ||
reason = "" | ||
if emailInfo['enabled']: | ||
subject = emailInfo["mailsubject"].format(status=status) |
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.
This start and finished transfer email might be quite spammy. I kept the old functionality because maybe it's not that bad.
@@ -119,65 +122,99 @@ def main(): | |||
logger.info("This process will exit now, and {0} will get picked up by the other illumina-uploader process".format(single_run)) | |||
exit(0) | |||
else: | |||
sleeptimeInSeconds = int(localInfo["sleeptime"])*60 |
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.
This only needs to be calculated once.
logger.info("Sleeping for {0} minutes".format(localInfo["sleeptime"])) | ||
|
||
time.sleep(sleeptimeInSeconds) | ||
except FileNotFoundError as error: |
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 want the script to continue running even if there's a file/folder/network error. Let it try again after some time.
except FileNotFoundError as error: | ||
logger.info(error) | ||
if emailInfo['enabled'] and not shouldStopEmails: | ||
shouldStopEmails = True |
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.
This helps prevent it from spamming folder not found or network unavailable errors. We'll wait until it's successful again before resetting this.
if mcmsEmailInfo["enabled"]: | ||
mcms.send_email(mcmsEmailInfo['emailurl'], mcmsEmailInfo['mailto'], subject, body) | ||
|
||
time.sleep(sleeptimeInSeconds) |
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 won't get to the sleep at the bottom of the main thread so we should sleep here.
|
||
time.sleep(sleeptimeInSeconds) | ||
except Exception as err: | ||
if emailInfo['enabled']: |
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 should send an email in case something else goes wrong.
Moved some exceptions around
Added a flag to prevent spamming emails when things fail