Changeset 20270


Ignore:
Timestamp:
02/27/16 21:17:19 (9 years ago)
Author:
Eric.Larour
Message:

CHG (JS):

  • successful processing of the results when calling a remote cluster that returns the .outbin file as a typed array

buffer.

  • implementing a callback function in the solve.js routine, because the oReq Post routine that retrieves the outbin

typed array buffer from the server during the http request is an async call, which can therefore not be controlled
serially.

Location:
issm/trunk-jpl/src/m
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/clusters/generic.js

    r20267 r20270  
    3434                        }
    3535                } //}}}
    36                 this.UploadAndRun = function (fid,toolkitsstring,solutionstring,name) { //{{{
     36                this.UploadAndRun = function (md,callbackfunction,fid,toolkitsstring,solutionstring,name) { //{{{
    3737
    3838                        var oReq = new XMLHttpRequest();
     
    4141
    4242                        oReq.onload = function (oEvent) {
    43                                 var returnBuffer= oReq.response.slice();
    44                                 var returnBuffer_size= returnBuffer.byteLength;
    45                                 md.results= loadresultsfrombuffer(md,returnBuffer,returnBuffer_size);
     43                                var returnBuffer = new Uint8Array(oReq.response.slice());
     44                                var returnBuffer_size=returnBuffer.byteLength;
     45                                md.results= parseresultsfrombuffer(returnBuffer,returnBuffer_size);
     46                                callbackfunction();
    4647                        };
    4748
     
    5152
    5253                } /*}}}*/
    53 
    5454        }
  • issm/trunk-jpl/src/m/solve/solve.js

    r20269 r20270  
    2323//      - checkconsistency : 'yes' or 'no' (default is 'yes'), ensures checks on consistency of model
    2424//      - restart: 'directory name (relative to the execution directory) where the restart file is located.
     25//      - callback: callback function to be called upon receiving the results from the server, or local computations.
    2526//
    2627//   Examples:
     
    101102        toolkitsstring= md.toolkits.ToolkitsFile(md.miscellaneous.name + '.toolkits'); // toolkits file
    102103
     104        //callback function:
     105        function callbackfunction(){}; //default, do nothing if no callback requested.
     106        if (options.getfieldvalue('callback',false)){
     107                callbackfunction=options.getfieldvalue('callback');
     108        }
    103109
    104110        if (cluster.classname() == 'local'){  //{{{
     
    116122                md.results = loadresultsfrombuffer(md,outputbuffer,outputbuffersize);
    117123               
     124                //Call back?
     125                callbackfunction();
     126
    118127                return md;
    119128
     
    122131
    123132                /*We are running somewhere else on a computational server. Send the buffer to that server and retrieve output: */
    124                 cluster.UploadAndRun(fid,toolkitsstring,solutionstring,md.miscellaneous.name);
     133                cluster.UploadAndRun(md,callbackfunction,fid,toolkitsstring,solutionstring,md.miscellaneous.name);
    125134
    126135                return md;
Note: See TracChangeset for help on using the changeset viewer.