saving a job.parallel object

조회 수: 7 (최근 30일)
Sandra Martinez
Sandra Martinez 2025년 2월 6일
댓글: Sandra Martinez 2025년 2월 12일
I'm running in batch and I would like to save the variable job (CJSIndependentJob or CJSTask object).
is it possible?
  댓글 수: 2
Steven Lord
Steven Lord 2025년 2월 6일
What do you hope/plan to do with the saved job object? Do you hope to use it to somehow pause the job and resume it later on, to be able to rerun the job, etc.?
Sandra Martinez
Sandra Martinez 2025년 2월 6일
이동: Steven Lord 2025년 2월 6일
Hi Steven,
I would like to save it in a file, to eventually be able to download data from it such as: errors, Date Time, execution time, etc. I already saw that I can do this by using [pending,running,completed] = findTask(job); and retrieve the duration time from there using the FinishDateTime and StartDateTime methods and saving that to a txt. But it seems to me that the simplest thing would be to directly save the work and eventualy do a load if I want to access that data later. Maybe it is too heavy to save the entire job object, but in principle I would like to know how to do it.

댓글을 달려면 로그인하십시오.

채택된 답변

Edric Ellis
Edric Ellis 2025년 2월 7일
It is not supported to save job / task objects themselves - the expected workflow is that you use parcluster to get back your job / task when you restart MATLAB. In other words:
% First MATLAB session - initiate batch job
clus = parcluster("myProfile");
job = batch(clus, @someFcn, numOutputs, {in1, in2});
% Later, restart MATLAB
clus = parcluster("myProfile")
clus.Jobs % Look at existing jobs
job = clus.Jobs(3) % or whatever
  댓글 수: 6
Edric Ellis
Edric Ellis 2025년 2월 12일
What I meant was that each individual invocation of batch returns a scalar parallel.Job instance. If you want to wait for all jobs, you could just call wait in a loop, or do:
arrayfun(@wait, job)
Sandra Martinez
Sandra Martinez 2025년 2월 12일
excellent! that was what I needed!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simple Batch Processing에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by