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

Adds an option to append the Cluster and Job numbers to the output files #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GregoryAshton
Copy link
Contributor

For jobs with queus > 1, all the output is written to the same file. This provides a unique filename for the output files to avoid that. Off by default.

Let me know if there are any changes you'd like, e.g., the argument name is a bit wooly (or feel free to do it yourself).

@jrbourbeau
Copy link
Member

Thanks for this contribution @GregoryAshton!

Out of curiosity, what is your particular use case? You may be able to set name='$(Process)' when adding arguments to a Job to append the queue number to each of the output files. For example,

job = pycondor.Job('examplejob',
                   executable='script.py',
                   error=error,
                   output=output,
                   log=log,
                   submit=submit,
                   queue=5)
job.add_arg('--argument', name='$(Process)')
job.build()

That should avoid all of the jobs writing to the same file.

@GregoryAshton
Copy link
Contributor Author

Hi, thanks for the tip. I gave that a go, but I'm not sure it does what I need.

The purpose of the MR is that ones ends up with a logs directory separate logs files for each of the queued jobs. E.g.,

logs/examplejob_ProcessID_ClusterID.log
logs/examplejob_ProcessID_ClusterID.output
logs/examplejob_ProcessID_ClusterID.error

Where ProcessID and Cluster ID are the process and cluster's which produced the job.

Perhaps it is already possible with the existing structure, but I'm not sure I see how. The method you suggested seems to add another job to the dag.

@jrbourbeau
Copy link
Member

The method you suggested seems to add another job to the dag

Thanks for pointing that out. I was able to reproduce this unexpected behavior.

I think the origin of this issue is that using name='$(Process)' when adding a job argument appends '$(Process)' to the job name in the corresponding Dagman submit file. I opened up #127 to not include job argument names in the Dagman submit file. Do the changes made in #127 fix the issues you're seeing in your particular use case?

@GregoryAshton
Copy link
Contributor Author

Yes, this solves the issue. Please feel free to remove this MR!

@GregoryAshton
Copy link
Contributor Author

Actually, apologies, having tested this a bit further, this seems to create a second job with arg_1 appended. Then the initial arguments don't get passed through properly. Could this be because I'm passing the arguments argument into pycondor.Job?

@jrbourbeau
Copy link
Member

jrbourbeau commented Nov 29, 2018

Could this be because I'm passing the arguments argument into pycondor.Job?

Quite possibly. The arguments keyword argument for pycondor.Job doesn't currently support named arguments. Right now that's only possible using the Job.add_arg method. So, to have a Job with a named argument (e.g. with '$(Cluster)_$(Process)' like proposed here) something like

job = pycondor.Job(..., arguments='--some_option')

will need to be replaced with

job = pycondor.Job(..., arguments='--some_option')
job.add_arg('--some_option', name='$(Cluster)_$(Process)')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants