JobQueue example is outdated #1305

Closed
dioh opened this Issue Apr 13, 2015 · 2 comments

Projects

None yet

3 participants

@dioh
dioh commented Apr 13, 2015

In the documentation of JobQueue
http://pydoc.net/Python/Fabric/1.4.0/fabric.job_queue/

The example shows a one parameter constructor while actually its a two parameter method.

@zerok
zerok commented Apr 13, 2015

You are right. Once changed there is also the issue that the sample with threading as parallelisation method doesn't work because threads don't have an exitcode.

I am completely new to the internals of fabric but shouldn't a try/catch block within the WrappedCallableTask (or Task for that matter) class solve this so that we get an exit code depending on if an exception was thrown during the task execution or not?

Or is threading at this point not really a use-case anymore?

Additionally, would it make sense to move this whole sample code into a bunch of unittests?

@sivy
sivy commented Apr 13, 2015

The example is still wrong in 1.9.2.

# Make a job_queue with a bubble of len 5, and have it print verbosely
jobs = JobQueue(5)
jobs._debug = True
@sivy sivy self-assigned this Apr 13, 2015
@crlane crlane added a commit to crlane/fabric that referenced this issue Apr 13, 2015
@crlane crlane [#1305] Add queue for try_using examples f6cc61b
@crlane crlane added a commit to crlane/fabric that referenced this issue Apr 13, 2015
@crlane crlane [#1305] Only alter the exit_code if job is a Process
- Addresses this comment on issue:
   fabric#1305 (comment)
- no status code to set for Threads anyway
- only processes used in fabric internals
f97c9db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment