Skip to content

Conversation

@kkthxbye-code
Copy link
Contributor

Fixes: #5479

Allows setting the job_timeout Meta attribute on scripts and the job_timeout attribute on reports. I tested UI, API and CLI execution. Scripts ran through the CLI do not support the timeout, as those are not ran through the rqworker for some reason.

I had to change enqueue_job slightly as I found no way to pass the timeout via. the delay method added by the @job decorator.

@kkthxbye-code
Copy link
Contributor Author

Fixed build failing because of pep8 check (I should get those git hooks working). Just squash before merging.

@jeremystretch jeremystretch deleted the branch netbox-community:develop April 6, 2022 18:18
@jeremystretch jeremystretch reopened this Apr 6, 2022
@DanSheps DanSheps requested a review from jeremystretch April 8, 2022 14:58

func.delay(*args, job_id=str(job_result.job_id), job_result=job_result, **kwargs)
queue = django_rq.get_queue("default")
queue.enqueue(func, job_id=str(job_result.job_id), job_result=job_result, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

I don't know enough about django_rq to know if there is a reason to use the job decorator over just enqueuing the job.

I do like that doing this also gives us the ability to schedule jobs down the line.

Copy link
Member

Choose a reason for hiding this comment

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

Should have the same net effect either way.

Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

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

Excellent work, thank you!

@jeremystretch jeremystretch changed the base branch from feature to develop April 8, 2022 17:53
@jeremystretch jeremystretch merged commit 84c3058 into netbox-community:develop Apr 8, 2022
@kkthxbye-code kkthxbye-code deleted the job-timeout branch May 9, 2022 16:36
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2022
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.

Allow customization of job timeout for scripts

3 participants