Issue 56 in fabricate: chdir doesn't work in parallel mode

13 views
Skip to first unread message

fabr...@googlecode.com

unread,
Mar 3, 2014, 5:46:58 AM3/3/14
to fabrica...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 56 by wer...@beroux.com: chdir doesn't work in parallel mode
http://code.google.com/p/fabricate/issues/detail?id=56

What steps will reproduce the problem?
1. main(parallel_ok=True, jobs=2)
2. os.chdir(...)
3. after()
4. run(...)

What is the expected output? What do you see instead?

Expecting: run() to be executed in the new directory.
Actual: run() is executed in the previous/starting directory.


What version of the product are you using? On what operating system?
Latest release as of today.


Please provide any additional information below.
When no jobs are provided as args to main() is works.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

Lex Trotman

unread,
Mar 3, 2014, 6:16:21 AM3/3/14
to fabrica...@googlegroups.com
On 3 March 2014 21:46, <fabr...@googlecode.com> wrote:
> Status: New
> Owner: ----
> Labels: Type-Defect Priority-Medium
>
> New issue 56 by wer...@beroux.com: chdir doesn't work in parallel mode
> http://code.google.com/p/fabricate/issues/detail?id=56
>
> What steps will reproduce the problem?
> 1. main(parallel_ok=True, jobs=2)
> 2. os.chdir(...)

The os.chdir() is a standard python library function that knows
nothing about the process pool and so affects only the main process,
not the subprocesses in the pool.

> 3. after()

Since the os.chdir() is not run in parallel, this does nothing.

> 4. run(...)

Use the cwd=... keyword argument to set the working directory for the commands.

>
> What is the expected output? What do you see instead?
>
> Expecting: run() to be executed in the new directory.
> Actual: run() is executed in the previous/starting directory.

As explained above, this is the expected behaviour.

Cheers
Lex

>
>
> What version of the product are you using? On what operating system?
> Latest release as of today.
>
>
> Please provide any additional information below.
> When no jobs are provided as args to main() is works.
>
> --
> You received this message because this project is configured to send all
> issue notifications to this address.
> You may adjust your notification preferences at:
> https://code.google.com/hosting/settings
>
> --
> You received this message because you are subscribed to the Google Groups
> "fabricate users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to fabricate-use...@googlegroups.com.
> To post to this group, send email to fabrica...@googlegroups.com.
> Visit this group at http://groups.google.com/group/fabricate-users.
> For more options, visit https://groups.google.com/groups/opt_out.

fabr...@googlecode.com

unread,
Mar 3, 2014, 6:36:17 AM3/3/14
to fabrica...@googlegroups.com

Comment #1 on issue 56 by ele...@gmail.com: chdir doesn't work in parallel
mode
http://code.google.com/p/fabricate/issues/detail?id=56

The os.chdir() is a standard python library function that knows nothing
about the process pool and so affects only the main process, not the
subprocesses in the pool.

Use the cwd= keyword argument to the run() call to set the working
directory.

fabr...@googlecode.com

unread,
Mar 3, 2014, 7:17:35 AM3/3/14
to fabrica...@googlegroups.com

Comment #2 on issue 56 by wer...@beroux.com: chdir doesn't work in parallel
mode
http://code.google.com/p/fabricate/issues/detail?id=56

Thanks for that quick answer that solves it. I was hoping for such an
argument, just couldn't find it.

`help(run)` refers to `help(Builder.run)` which hints to `help(shell)` but
none of these talk about 'cwd' argument.

I'd suggest to improve the help in Python but possibly even more, and
probably simpler, in the Wiki. There are few main methods, run() and main()
should definitely have a full list of supported arguments. I'd also include
shell(), after(), and autoclean().

fabr...@googlecode.com

unread,
Mar 3, 2014, 7:52:40 AM3/3/14
to fabrica...@googlegroups.com

Comment #3 on issue 56 by ele...@gmail.com: chdir doesn't work in parallel
mode
http://code.google.com/p/fabricate/issues/detail?id=56

The help for shell() says:

"Any other kwargs are passed directly to subprocess.Popen"

Now subprocess.popen() is one of the bigger and messier Python functions,
(see http://docs.python.org/2/library/subprocess.html#popen-constructor)
and so I don't think its appropriate to repeat its documentation in
Fabricate's documentation.

But contributions to the wiki are of course welcome.

fabr...@googlecode.com

unread,
Mar 3, 2014, 8:00:22 AM3/3/14
to fabrica...@googlegroups.com

Comment #4 on issue 56 by wer...@beroux.com: chdir doesn't work in parallel
mode
http://code.google.com/p/fabricate/issues/detail?id=56

Oh! That's a subprocess.Popen argument. Still probably good to note it as
it's very useful. I've prepared a document if you wish to take a look for
reference, just email me.

fabr...@googlecode.com

unread,
Mar 3, 2014, 8:22:57 AM3/3/14
to fabrica...@googlegroups.com

Comment #5 on issue 56 by wer...@beroux.com: chdir doesn't work in parallel
mode
http://code.google.com/p/fabricate/issues/detail?id=56

Should make this item as solved. ;)
Reply all
Reply to author
Forward
0 new messages