circus-tent / circus

A Process & Socket Manager built with zmq
http://circus.readthedocs.org/
Other
1.55k stars 258 forks source link

working_dir not respected when opening stdout or stderr files #1048

Open MarkNahabedian opened 6 years ago

MarkNahabedian commented 6 years ago

I'm using circusd 0.14.0.

In my config file I define a watcher that specifies working_dir, stdout_stream.filename and stderr_stream.filename. When those are relative filepaths, I expect them to be resolved with respect to the value of the working_dir property of the watcher, rather than the directory that was current when I ran circusd.

This session illustrates the problem:

mark@pascal:~/circus-bugs/wrong_working_dir$ circusd --version
0.14.0
mark@pascal:~/circus-bugs/wrong_working_dir$ pwd
/home/mark/circus-bugs/wrong_working_dir
mark@pascal:~/circus-bugs/wrong_working_dir$ cat wrong_working_dir.ini 

[circus]
statsd = False
httpd = False

[watcher:wrong_working_dir]
respawn = False
shell = True
cmd = echo "This is a test"
working_dir = /home/mark/circus-bugs/wrong_working_dir
stdout_stream.class = WatchedFileStream
stdout_stream.filename = stdout
stderr_stream.class = WatchedFileStream
stderr_stream.filename = stderr
mark@pascal:~/circus-bugs/wrong_working_dir$ circusd wrong_working_dir.ini 
2017-12-04 14:10:15 circus[14580] [INFO] Starting master on pid 14580
2017-12-04 14:10:15 circus[14580] [INFO] Arbiter now waiting for commands
2017-12-04 14:10:15 circus[14580] [INFO] wrong_working_dir started
2017-12-04 14:10:20 circus[14580] [INFO] wrong_working_dir stopped
  C-c C-c2017-12-04 14:10:23 circus[14580] [INFO] Got signal SIG_INT
2017-12-04 14:10:23 circus[14580] [INFO] Arbiter exiting
2017-12-04 14:10:23 circus[14580] [INFO] Arbiter exiting
mark@pascal:~/circus-bugs/wrong_working_dir$ ls -lR
.:
total 12
-rw-rw-r-- 1 mark mark    0 Dec  4 14:10 stderr
-rw-rw-r-- 1 mark mark   15 Dec  4 14:10 stdout
drwxrwxr-x 2 mark mark 4096 Dec  4 13:55 use_this_dir
-rw-rw-r-- 1 mark mark  324 Dec  4 14:09 wrong_working_dir.ini

./use_this_dir:
total 0
mark@pascal:~/circus-bugs/wrong_working_dir$ cat stdout
This is a test
mark@pascal:~/circus-bugs/wrong_working_dir$ 

Here's my config file:

[circus]
statsd = False
httpd = False

[watcher:wrong_working_dir]
respawn = False
shell = True
cmd = echo "This is a test"
working_dir = /home/mark/circus-bugs/wrong_working_dir
stdout_stream.class = WatchedFileStream
stdout_stream.filename = stdout
stderr_stream.class = WatchedFileStream
stderr_stream.filename = stderr
k4nar commented 6 years ago

I guess this could be documented (if it's not), but I'm not in favor of introducing breaking compatibility changes of this kind at this stage of the project.

MarkNahabedian commented 6 years ago

"at this point in the project"? It's still major version number zero.

On Dec 6, 2017 6:32 AM, Yannick PÉROUX notifications@github.com wrote:

I guess this could be documented (if it's not), but I'm not in favor of introducing breaking compatibility changes of this kind at this stage of the project.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/circus-tent/circus/issues/1048#issuecomment-349612888, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AgONk-hQqEsngBlj2JtTQM7oqZACrE2pks5s9ntigaJpZM4Q1M1Q.

k4nar commented 6 years ago

By that I meant that Circus is working well but is not very actively developed. Most users probably don't expect breaking changes as with an active and "young" project.

MarkNahabedian commented 6 years ago

I'm sorry to hear that. From my experiences with circus over the past couple months, it seems to me that there's so much more to be done:

Which properties ${} substitution occurs for is seemingly random. There were places where I had to fall back to the %() substitution implemented by configparser.

There's no way to specify a set of property definitions that are common to a number of watchers. I have a dozen watchers that differ only in command, arguments and log file names, and the last could be based on the watcher's name if ${} substitution worked for the *_strean.filename properties.

There's no way to conditionally compute the value of a property.

I'm sure a few other issues would come to mind if I thought more about it.

On Dec 6, 2017 9:41 AM, Yannick PÉROUX notifications@github.com wrote:

By that I meant that Circus is working well but is not very actively developed. Most users probably don't expect breaking changes as with an active and "young" project.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/circus-tent/circus/issues/1048#issuecomment-349659188, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AgONk59gA0EnCQdv6v7-t27NZtIN3Y6xks5s9qengaJpZM4Q1M1Q.