Skip to content
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

FEATURE: Work limited number of jobs #4

Closed
wants to merge 1 commit into from
Closed

Conversation

dfeyer
Copy link

@dfeyer dfeyer commented Jan 28, 2016

Long running jobs can exhaust the PHP memory limit. This allows you to
run as few or as many jobs as you'd like.

To use:

./flow job:work --limit

With Zsh, you could do something like this to do the next 500 jobs:

repeat 100 do ./flow job:work --limit=5 org.typo3.docs.combo; echo "did 5 jobs"; done

Long running jobs can exhaust the PHP memory limit. This allows you to
run as few or as many jobs as you'd like.

To use:

  ./flow job:work --limit <number> <queue-name>

With Zsh, you could do something like this to do the next 500 jobs:

  repeat 100 do ./flow job:work --limit=5 org.typo3.docs.combo; echo "did 5 jobs"; done
@dfeyer
Copy link
Author

dfeyer commented Jan 28, 2016

👍

@albe
Copy link

albe commented Jan 29, 2016

👍 by reading, we had something similar in a project, but with a time limit - makes total sense to somehow limit execution of the worker

@dlubitz
Copy link

dlubitz commented Mar 14, 2016

👍 by reading

@bwaidelich
Copy link
Contributor

Thanks for this and sorry for the lack of response. I'll incorporate this feature into the rewrite to be pushed by next week!

@dlubitz
Copy link

dlubitz commented Jul 14, 2016

@bwaidelich: Great. Maybe you could also consider this commit:
dlubitz@e60cbe4

Otherwise I can also create an PR after yours.

@bwaidelich
Copy link
Contributor

Hi all. I haven't yet added this to the "major overhaul" as promised (see #10), but IMO it is not necessary with that version anymore because:

  • Jobs can be executed in a separate thread, reducing the memory consumption drastically
  • There's a new flag --exit-after that allows the job:work command to quit after a given amount of seconds.

If you still think a hard limit on the amount of jobs makes sense, let me know and I'll try to incorporate this into the master branch once the PR is merged!

@bwaidelich
Copy link
Contributor

@dlubitz Now I remember where I've seen an example for that maxTime feature.. I couldn't find it and re-implemented it just now ;) but it should work similar to yours (except for the different flag name)

@dfeyer
Copy link
Author

dfeyer commented Jul 19, 2016

For NatIo the connection->wait() accept a number of job, and I think it's a good "metric", but number of second is also fine, feel free to close this one if your PR's solve the problem anyway

@dlubitz
Copy link

dlubitz commented Jul 20, 2016

@bwaidelich The hard limit would be very useful. I use it especially for mail sending to prevent exeeding limits of the webhoster (e.g n mails per minute/hour).

@bwaidelich
Copy link
Contributor

The hard limit would be very useful. I use it especially for mail sending [...]

Good point, I'll add it to the existing PR

bwaidelich added a commit to bwaidelich/jobqueue-common that referenced this pull request Jul 20, 2016
@bwaidelich
Copy link
Contributor

Implemented with 17adaf7

@bwaidelich bwaidelich closed this Jul 20, 2016
@kdambekalns kdambekalns deleted the limited-job-number branch February 15, 2018 18:36
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.

4 participants