|
"Jiaming " <stanley.hartwell@gmail.com> writes:
> Hi, I'm using the batch command to run a job on a remote cluster
> (j=batch(schedobj,'myscript.m','Matlabpool',n))). The job is an optimization
> routine that takes a very long time (say a week) to finish.
>
> I would like to monitor the progress of the optimization while it is
> running. However, it seems to me that I have to wait until the job
> finishes and then use diary(JOBID) to view its screen output.
You're right that currently you do have to wait for the job to complete
before the diary output is available.
> This makes it extremely difficult for me to monitor the performance of my
> program. (I will have to be left in the dark for a week to find out if the
> optimization works well or not). Is there any way to get around it?
For now, I would suggest having your batch job periodically print its
status to a text file. You'll need to work out a location on disk
accessible from the workers and from where you want to monitor things. I
would suggest using fopen/fprintf/fclose for each message to ensure the
file is updated. E.g.
fh = fopen('/path/to/logfile', 'at'); % open for appending text
if fh ~= -1
fprintf(fh, 'My log message\n');
fclose(fh);
end
Obviously, you could wrap that up in a simple function to make life a
little simpler.
> In addition, I also have the program dynamically writing a data set to
> a .mat file, which I could like to be able to access before the
> program finishes. This is all possible if I do not run the program as
> a batch job, but is there any way to do it when running as a batch
> job?
It should be possible - where are you saving the .mat file? Why can't
you access it? Do you get an error?
Cheers,
Edric.
|