Changeset 20267


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

CHG: new simplified interface to the generic cluster class, with just one method, UploadAndRun.

File:
1 edited

Legend:

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

    r19793 r20267  
    55
    66function generic (){
     7        //properties
     8        // {{{
     9        var args = Array.prototype.slice.call(arguments);
     10        var options = new pairoptions(args.slice(0,args.length));
     11
     12        this.url=options.getfieldvalue('url','');
     13        this.np=options.getfieldvalue('np',3);
     14        this.codepath=options.getfieldvalue('codepath','issmdir/bin');
     15        this.executionpath=options.getfieldvalue('executionpath','issmdir/execution');
     16        //}}}
    717        //methods
    8         this.setdefaultparameters = function(){// {{{
    9                 this.name='';
    10                 this.login='';
    11                 this.np=1;
    12                 this.port=0;
    13                 this.interactive=1;
    14                 this.codepath='issmdir/bin';
    15                 this.etcpath='issmdir/etc';
    16                 this.executionpath= 'issmdir/execution';
    17                 this.valgrind='issmdir/externalpackages/valgrind/install/bin/valgrind';
    18                 this.valgrindlib='issmdir/externalpackages/valgrind/install/lib/libmpidebug.so';
    19                 this.valgrindsup='issdir/externalpackages/valgrind/issm.supp';
    20                 this.verbose=1;
    21                 this.shell='/bin/sh';
    22         }// }}}
    2318        this.disp= function(){// {{{
    2419                console.log(sprintf('   generic class echo:'));
    25                 console.log(sprintf('    name: %s',this.name));
    26                 console.log(sprintf('    login: %s',this.login));
     20                console.log(sprintf('    url: "%s"',this.url));
    2721                console.log(sprintf('    np: %i',this.np));
    28                 console.log(sprintf('    port: %i',this.port));
    29                 console.log(sprintf('    codepath: %s',this.codepath));
    30                 console.log(sprintf('    executionpath: %s',this.executionpath));
    31                 console.log(sprintf('    etcpath: %s',this.etcpath));
    32                 console.log(sprintf('    valgrind: %s',this.valgrind));
    33                 console.log(sprintf('    valgrindlib: %s',this.valgrindlib));
    34                 console.log(sprintf('    valgrindsup: %s',this.valgrindsup));
    35                 console.log(sprintf('    verbose: %s',this.verbose));
    36                 console.log(sprintf('    shell: %s',this.shell));
     22                console.log(sprintf('    codepath: "%s"',this.codepath));
     23                console.log(sprintf('    executionpath: "%s"',this.executionpath));
    3724        }// }}}
    3825        this.classname= function(){// {{{
     
    4734                        }
    4835                } //}}}
    49         //properties
    50         // {{{
    51         this.name='';
    52         this.login='';
    53         this.np=NaN;
    54         this.port=NaN;
    55         this.interactive=NaN;
    56         this.codepath='';
    57         this.etcpath='';
    58         this.executionpath='';
    59         this.valgrind='';
    60         this.valgrindlib='';
    61         this.valgrindsup='';
    62         this.verbose=NaN;
    63         this.shell='';
    64         this.setdefaultparameters();
    65         //}}}
    66 }
     36                this.UploadAndRun = function (fid,toolkitsstring,solutionstring,name) { //{{{
     37
     38                        var oReq = new XMLHttpRequest();
     39                        oReq.open("POST", this.url, true);
     40                        oReq.responseType = 'arraybuffer';
     41
     42                        oReq.onload = function (oEvent) {
     43                                var returnBuffer= oReq.response.slice();
     44                                var returnBuffer_size= returnBuffer.byteLength;
     45                                md.results= loadresultsfrombuffer(md,returnBuffer,returnBuffer_size);
     46                        };
     47
     48                        var blob = new Blob(new Int8Array(fid.buffer), {type: 'text/plain'});
     49                        oReq.send(blob);
     50                        return;
     51
     52                } /*}}}*/
     53
     54        }
Note: See TracChangeset for help on using the changeset viewer.