Skip to content

Avoid execution of custom functions right after resuming/restarting experiment#29

Open
dgruano wants to merge 1 commit intoFYNCH-BIO:hotfixfrom
dgruano:hotfix
Open

Avoid execution of custom functions right after resuming/restarting experiment#29
dgruano wants to merge 1 commit intoFYNCH-BIO:hotfixfrom
dgruano:hotfix

Conversation

@dgruano
Copy link
Copy Markdown
Contributor

@dgruano dgruano commented Dec 10, 2020

What? Why?

Wait to execute custom functions only after enough timepoints have been captured after an experiment pause. This can lead to an unwanted dilution based on OD values logged before an experiment pause. Solves #28

Changes proposed in this pull request:

  • Add countdown inside namespace
  • Not execute custom functions until countdown finishes

NOTE: another possible implementation is passing the countdown as a parameter (or a boolean flag) to the custom functions, in case there's logic that should be nevertheless executed.

Checks

  • Updated documentation.
  • Follows 7 rules of great commit messages. For most PRs a single commit should suffice, in some cases multiple topical commits can be useful. During review it is ok to see tiny commits (e.g. Fix reviewer comments), but right before the code gets merged to master or rc branch, any such commits should be squashed since they are useless to the other developers. Definitely avoid merge commits, use rebase instead.
  • Follows the Google Style Guide.

Wait to execute custom functions only after enough timepoints have been
captured.
logger.debug('elapsed time: %.4f hours' % elapsed_time)
print("{0}: {1} Hours".format(EXP_NAME, elapsed_time))

if self.start_countdown > 0:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Make this a ternary operator so it's a little more clean.

self.save_data(data['data'].get(param, []), elapsed_time,
VIALS, param + '_raw')
# run custom functions
self.custom_functions(data, VIALS, elapsed_time)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we really want nothing to happen until this countdown is finished? I feel like the countdown should be used within the custom functions - this way it can be up to the logic within the function to decide how it wants to handle the restart.

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.

2 participants