I have a function to load large files into a "HSQL(Standalone)"
database for processing that uses Monitor
to update the interface on the progress and status of the upload.
loadBigFile[t_Integer?Positive, steps_Integer?Positive] :=
Module[{stepProgress = 0},
Monitor[
While[stepProgress < steps,
(* Read batch and load to db *)
Pause[t];
stepProgress += 1
],
Column[{StringRiffle[ToString /@ {stepProgress, steps}, " of "],
ProgressIndicator[stepProgress, {0, steps}]},
Alignment -> Center]
];
stepProgress
]
loadBigFile
is just to demonstrate the issue.
loadBigFile[1, 10]
(* 10 *)
This process takes 30+ minutes to load each file. I would like to concurrently load these files to reduce the wait time by using ParallelSubmit
.
k = LaunchKernels[2];
DistributeDefinitions[loadBigFile];
{f1, f2} = {ParallelSubmit[loadBigFile[1, 5]], ParallelSubmit[loadBigFile[1, 9]]}
When I execute WaitAll
the EvaluationObject
s do run concurrently. However, instead of a monitor temporary cell for each of them I get a front end error from each kernel they are running on.
WaitAll[{f1, f2}]
CloseKernels[k];
(* {5, 9} *)
FrontEndObject::notavail: A front end is not available; certain operations require a front end.
How do I get the monitor temporary cells to show in the notebook for each EvaluationObject
running? Or is there another method I should use for concurrent execution with Monitor
?