Skip to content

Run safety ensurer iso mds checkup on migrate events#2254

Merged
JeffreyDevloo merged 12 commits into2.9.xfrom
2.9_no_more_mds_checkup_on_migrate
Feb 12, 2019
Merged

Run safety ensurer iso mds checkup on migrate events#2254
JeffreyDevloo merged 12 commits into2.9.xfrom
2.9_no_more_mds_checkup_on_migrate

Conversation

@JeffreyDevloo
Copy link
Contributor

No description provided.

if not registrations:
continue
# Filter out all the tasks are are no longer running within celery
running_registrations = []
Copy link
Contributor

Choose a reason for hiding this comment

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

This improvement in naming <3

if running_registrations == registrations:
# No changes required to be made
continue
persistent.assert_value(key, running_registrations, transaction=transaction)
Copy link
Contributor

Choose a reason for hiding this comment

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

You assert the value running_registrations, and immediately afterwards set it to this same value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mistake on my end

:param args: Arguments without default values
:param kwargs: Arguments with default values
"""
ensure_single = EnsureSingle(ensure_single_container, self)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is always done in the inner functions, so why not do it in the general function?

Copy link
Contributor Author

@JeffreyDevloo JeffreyDevloo Feb 11, 2019

Choose a reason for hiding this comment

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

The self part is not defined in the general function
The constructor also fetches some runtime parameters which cannot be fetched on load time

@decorator is executed when loading in the module, this does not have any runtime info which the ensure single needs.

# type: (dict, float, Tuple[str, str], int, int) -> None
"""
Ensure that the number of jobs don't exceed the limit
- Test if the current job limit is not reach
Copy link
Contributor

Choose a reason for hiding this comment

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

reach_ed_

:type task_logs: Tuple[str, str]
:param job_limit: Number of jobs to keep running at any given time
:type job_limit: int
# @todo is this sane? Can't it be done with just the job limit?
Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, both cover the same use as far as i see

try:
if slept:
self.logger.info('{0} had to wait {1} seconds before being able to start'.format(task_log_name, slept))
if slept >= timeout:
Copy link
Contributor

Choose a reason for hiding this comment

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

will now log
X had to wait Y before being able to start Could not start Z`
upon timeout.

if slept:
   slept < timeout:
      log dis
   else:
      log dat


successful = True
try:
if slept:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same goes for this construction as previous comment

:return: None
"""
if self.unittest_mode:
self.logger.info('Setting {} to {}'.format(self.thread_name, (state, value)))
Copy link
Contributor

Choose a reason for hiding this comment

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

{0} and {1}

else:
self.message = 'Ensure single {0} mode - ID {1} - {{0}}'.format(self.ensure_single_container.mode, self.now)

def unittest_set_state(self, state, value):
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps set None as default for value, or does this have flaws?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need

if not initial_registrations:
continue
# Filter out all the tasks are are no longer running within celery
# @todo might be better to do in update code?
Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, please do this in the update code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once I backport it, I will

@JeffreyDevloo JeffreyDevloo merged commit ecb4af4 into 2.9.x Feb 12, 2019
@ghost ghost removed the state_inprogress label Feb 12, 2019
@JeffreyDevloo JeffreyDevloo deleted the 2.9_no_more_mds_checkup_on_migrate branch February 12, 2019 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants