Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

raises exception if background and wait_until_complete flags are not set... #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

raises exception if background and wait_until_complete flags are not set... #64

wants to merge 1 commit into from

Conversation

paiweilai
Copy link

... properly

@@ -45,6 +45,10 @@ def submit_multiple_jobs(self, jobs_to_submit, background=False, wait_until_comp
"""
assert type(jobs_to_submit) in (list, tuple, set), "Expected multiple jobs, received 1?"

# Check if the flags are properly set
if background == False and wait_until_complete == False:
raise InvalidFlagsToSubmitJob('Set background=True if wait_until_complete=False to send background jobs')
Copy link

Choose a reason for hiding this comment

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

Please add a reason why this combination is invalid.

Copy link

Choose a reason for hiding this comment

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

Agreed - this is definitely a valid combination. The "background" flag simply specifies if this is a foreground or background job. The "wait_until_complete" flag specifies whether we're blocking until we get our response. It is possible (and probably encouraged) to not block on a foreground job.

Copy link
Author

Choose a reason for hiding this comment

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

If jobs are sent as foreground, the gearmand server will not put them in
the queue (e.g. MySQL).

The server starts run these jobs after 'wait_until_jobs_accepted'.

However, because the submit_job method returns to the caller shortly after,

what will happen is that most of these foreground jobs will be dropped by
the server and not executed.

(I have an example code confirmed this.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants