Update the simulation status, max time remaining, and the progress over python in job manager CAD

RyanChungRyanChung Member Posts: 2
edited May 24 in Photonics

Hi, I'm working on the user-defined "torque.py" for optimization(or sweep) job scheduler in CAD-free (without GUI) linux operating system. I noticed that in the .py file (*\Lumerical\v211\scripts\job_schedulers\*) there's a line calling print like this: print('<status> RUNNING </status>') or print('<complete/>'). I'm guessing that it's for the update of the simulation situation shown in the CAD of job manager on the local PC. Given the information such as max time remaining, autoshutoff, and %progress can be extracted by downloading the "*_p0.log" file back to the local from the cluster and by the usage of str.split() over python, I'd like to update them shown in the CAD of job manager on local PC but I'm not sure how to manage the communication between the CAD and python. Is it something like "print(<Autoshutoff level>0.87</Autoshutoff level>)", "print(<Max time remaining>8 mins, 7 secs</Max time remaining>)", or "print(<Progress>87%</Progress>)", along with the syntax "sys.stdout.flush()"?

Thanks

Best Answer

  • greg_baethgegreg_baethge Posts: 120Ansys Employee
    edited May 24 Accepted Answer

    Hi @RyanChung,

    Thanks for posting your question. This is not much documented on our side, so I'm not too sure what is possible and what is not. That said, I had a look at the other scheduler scripts, and I noted a function that is not present in "torque.py"

    def update_progress_from_stdout_file(job_name, job_id, prev_log_lines)
    

    This function reads sdtout and "feeds" the progress in the job manager. Schedulers like Slurm will forward sdtout to a file and this is the file the script reads to get the progress. From what I understand, by default, Torque doesn't update the file until the end of the job.

    What you suggest could work with FDTD only, as the simulation progress are stored in the log file. In your script, you would have to load only the lines like:

    0.00800595% complete. Max time remaining: 6 mins, 24 secs. Auto Shutoff: 1
    

    So you'd have to transfer the log file back to your local PC, and extract the lines in a functions as above.

Answers

Sign In or Register to comment.