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

Write CASA logs to named log directory #2

Open
Jordatious opened this issue Jan 14, 2021 · 2 comments
Open

Write CASA logs to named log directory #2

Jordatious opened this issue Jan 14, 2021 · 2 comments

Comments

@Jordatious
Copy link
Collaborator

CASA logs get written to casa-timestamp.log, but it would be useful if they were named like the SLURM logs, according to the task and job / task array ID that wrote them.

It is possible to rename the logs immediately after importing casatasks, such as:

import os
import casatasks
casatasks.casalog.setlogfile('logs/{SLURM_JOB_NAME}-{SLURM_ARRAY_JOB_ID}_{SLURM_ARRAY_TASK_ID}.casa'.format(**os.environ))

However, it seems a very short default CASA log with the timestamp still gets written before this.

@Jordatious
Copy link
Collaborator Author

As I've looked more into this, it seems there is still a bunch of stuff that goes to the default log, at least when you're running MPI (not sure about otherwise), so I've also found it's necessary to add this at the end:

os.rename(casatasks.casalog.logfile(),'logs/{SLURM_JOB_NAME}-{SLURM_ARRAY_JOB_ID}_{SLURM_ARRAY_TASK_ID}.mpi'.format(**os.environ))

@Jordatious
Copy link
Collaborator Author

It seems necessary to first store the output name, before renaming it with setlogfile(), using:

logfile=casatasks.casalog.logfile()

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

No branches or pull requests

1 participant