vixus0 / awful-tools

A python framework for job management on MP systems.
1 stars 0 forks source link

Output / input redirection #5

Closed pbugnion closed 11 years ago

pbugnion commented 11 years ago

I think it would be helpful to allow IO redirection. At the moment, stdout is pushed to /dev/null and stderr to a /tmp/mdrunr.log file.

These are good defaults, I think, but allowing the user to specify a file name / stream to write to might be useful?

I'm happy to code this up.

vixus0 commented 11 years ago

Well torque for instance writes to jobname.eID and jobname.oID On Feb 5, 2013 8:54 AM, "pbugnion" notifications@github.com wrote:

I think it would be helpful to allow IO redirection. At the moment, stdoutis pushed to /dev/null and stderr to a /tmp/mdrunr.log file.

These are good defaults, I think, but allowing the user to specify a file name / stream to write to might be useful?

I'm happy to code this up.

— Reply to this email directly or view it on GitHubhttps://github.com/vixus0/awful-tools/issues/5.

pbugnion commented 11 years ago

Hmm... Same with PBS. Additionally, in PBS, you can redirect stderr to stdout.

I guess we could do the same. We don't really have a job id, so we could just use the extensions .out and .err.

If the user wants different redirection, he can always use the shell redirection operators in the job definition:

>>> job = mdc.Mdjob("job", "echo hello > output_file")

If suggest the following:

vixus0 commented 11 years ago

Sounds good, yeah. Since they'll be put in the working directory of the job there shouldn't be any issues with overwrites or confusion.

It's easy enough to allow the user to specify whatever filename/path in place of jobname.out and jobname.err and just use the stdout=, stderr= arguments to subprocess.Popen to redirect accordingly. So you'd set stderr=subprocess.STDOUT to redirect stderr to stdout.

I can do this when I implement the shell interface today.

On 5 February 2013 13:42, pbugnion notifications@github.com wrote:

Hmm... Same with PBS. Additionally, in PBS, you can redirect stderr to stdout.

I guess we could do the same. We don't really have a job id, so we could just use the extensions .out and .err.

If the user wants different redirection, he can always use the shell redirection operators in the job definition:

job = mdc.Mdjob("job", "echo hello > output_file")

If suggest the following:

  • redirect stdout and stderr to jobname.out and jobname.err.
  • add a combine_err_out keyword argument to mdc.Mdjob that redirects both stdout and stderr to jobname.out.

    — Reply to this email directly or view it on GitHubhttps://github.com/vixus0/awful-tools/issues/5#issuecomment-13129534.

pbugnion commented 11 years ago

Cool. I guess the last thing we could consider is redirecting stdin from a file. To be honest, I can't imagine ever having to do that (I expect most codes use input files). Anyway, the user could always just specify the redirection in the command line arguments.

pbugnion commented 11 years ago

Closed by c55b81f.