Skip to content

Write CASA logs to named log directory

Created by: Jordatious

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.