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

Don't update Queue on initialization #84

Open
MikeDacre opened this issue Feb 5, 2018 · 2 comments
Open

Don't update Queue on initialization #84

MikeDacre opened this issue Feb 5, 2018 · 2 comments
Assignees
Milestone

Comments

@MikeDacre
Copy link
Owner

There is actually no need to know what is in the queue until the Queue class is queried, so let's drop the update call from the Queue initialization.

Also, each Job class doesn't really need its own Queue, we could just create a single Queue class and link all Jobs to it.

@MikeDacre MikeDacre added this to the 0.6.2 milestone Feb 5, 2018
@MikeDacre MikeDacre self-assigned this Feb 5, 2018
@petercombs
Copy link

petercombs commented Feb 7, 2018

One way to go about this would be to have an option in Job.__init__ to take queue as a keyword argument, and otherwise fallback to create its own. i.e.
self.queue = kwds.get('queue', _queue.Queue(user='self', qtype=self.qtype))
(although note that you would need to update the allowable keyword args in options.py.

@MikeDacre
Copy link
Owner Author

Yeah, that's a pretty good idea. I could also make the default an instance-wide default loaded at the top of job.py, that would add a potential hang point during the initial import, but would make the default be the already created class.

I wonder if there is a way to add a timeout in python for external commands? That would be really helpful here, as I could then add a timeout for the instance-wide version.

Another option would be to make the instance-wide version a placeholder and populate it only if it does not currently exist.

MikeDacre added a commit that referenced this issue Mar 13, 2018
Altered job, queue, and __init__ modules to delay any initialization
that requires queue parsing until absolutely required—so all checks
happen just in time, and not at import or initialization.

This makes everything a lot faster and more efficient.
MikeDacre added a commit that referenced this issue Mar 13, 2018
Altered job, queue, and __init__ modules to delay any initialization
that requires queue parsing until absolutely required—so all checks
happen just in time, and not at import or initialization.

This makes everything a lot faster and more efficient.

Also fixes documentation on readthedocs and makes test skipping more
robust in a variety of situations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants