On Tue, 11 Mar 2014 20:03:22 GMT, Craig Dillabaugh wrote:
(...)
Since, I figure someone may ask what classifyTask does here it is:void classifyTask( ulong[] band_list, string classifier, string classifier_config, string image_dir, ImageDB src_image ) { string[] classify_args; classify_args.length = 4 + band_list.length; tileDesc tl = src_image.tiles; classify_args[0] = "../bin/classify"; classify_args[1] = "cluster"; //Currently only supported classifier classify_args[2] = g_config.tmp_dir ~ "isoclus.out.json"; foreach( int t_x; iota( 0, tl.xTileBaseCount() ) ) { foreach( int t_y; iota( 0, tl.yTileBaseCount() ) ) { classify_args[3] = g_config.tmp_dir ~ "class/" ~ rawTileName( src_image.nextId(), t_x, t_y); foreach(idx, bnd; band_list ) { classify_args[4 + idx] = image_dir ~ rawTileName( to!int(bnd), to!int(t_x), to!int(t_y) ); } debug { foreach( str; classify_args) { std.stdio.write(str, " "); } writeln(); } auto cpid = std.process.spawnProcess(classify_args); std.process.wait(cpid); //wait until its done to proceed. } } logInfo("Classification complete: " ~ Clock.currTime.toISOExtString() ); }
Is it possible that something I am doing in my classifyTask() function is blocking the server response?
The std.process.wait
is the evil call here. There are two possibilities to solve this:
- use
runWorkerTask
+ proper synchronization instead ofrunTask
- use these gists: PipedProcess, StdFileStream