Error Batch Job does not exist

#1

Batch Job executions is ok until the doStrart area. When it arrives to job.scheduleBatches(batches) …

{
“id” : “5249.1932”,
“codes” : [ “NotClassified” ],
“key” : “c3.engine.database.async.JobBaseMethods_runDoesNotExist”,
“template” : “Job run {}:{}:{} does not exist”,
“parameters” : [ “MeasurementSeriesRepairBatchJob”, “6716f7a8-0456-4404-854e-0d1060da9b25”, “” ]
}

thanks

#2

Where do you see this error? Can you share the definition of your job and how you’re trying to launch it?

#3

Defintion:

type MeasurementSeriesRepairBatchJob extends BatchJob<MeasurementSeriesRepairBatchJob,MeasurementSeriesRepairJobConfig,MeasurementSeriesRepairJobOptions> type key 'MRJ'{
    doStart:      ~ js server
    processBatch: ~ js server
    allComplete:  ~ js server
}

config:

type MeasurementSeriesRepairJobConfig {
   id: string
}

options:

type MeasurementSeriesRepairJobOptions {
   id : string
   name : string
   Type : string
}

Action:

var log = C3.logger('MeasurementSeriesRepairBatchJob');



function doStart(job, targets) {
    log.info('MeasurementSeriesRepairBatchJob start');
    var result = new Array();

    //delta

    var measers = Measurement.evaluate({
        projection: "unique(parent.id)",
        limit: -1
    });
   
    

    for (var i = 0; i < measers.tuples.length; i++) {
        var gipsy = PhysicalMeasurementSeries.get(measers.tuples[i].cells[0].str);
        //console.log(gipsy);
        if (gipsy == undefined) {
            result.push([measers.tuples[i].cells[0].str, 'd']);
        }

    }


//code, code code .......

//final function 


   log.info("Result: "+result.toString());

  //RESULT EXAMPLE    result= [[IT002E9062399A,d],[AS_ACW_DIRNS_ISOIL_ML311_V2_2D539B_TE_H,r]];  

    var batches = _.map(result, function (name) {
        log.info("name_first: "+name[0].toString()+" type: "+name[1].toString());
       // return MeasurementSeriesRepairJobOptions.make({id: name[0].toString(), name: name[0].toString(), Type: name[1].toString() });
           // name: name[0],
            //Type: name[1]
            return { name: name[0] };
    });
    log.info("batches: "+batches);
    job.scheduleBatches(batches);    //ERROR IS HERE
}

function processBatch(batch,job,options) {
         
        log.info('processBatch ({}, {}, {})', JSON.stringify(batch), JSON.stringify(job), JSON.stringify(options));
        var name = batch.name;
        var type = batch.Type;
        log.info("name: "+name.toString());
        var orph = Measurement.fetch({
            filter: 'parent.id=="' + name + '"',
            limit: -1
        });

//code code code ....

}

i found few documents about BatchJob i hope everything is correct
thanks

#4

ops :slight_smile:
launch:

var job = MeasurementSeriesRepairBatchJob.make().upsert();
MeasurementSeriesRepairBatchJob.doStart(job);


Uncaught C3.client.ActionError {name: “ActionError”, message: “Job run MeasurementSeriesRepairBatchJob:684843da-4fe3-419b-aaaa-937478b4e351: does not exist”, error: C3.t…s.Obj, stack: “Error: Job run MeasurementSeriesRepairBatchJob:684…961:20), :5:8)↵ at :1:33”}

#6

the job.scheduleBatches parameter what type of object must be ?

#7

From the documentation:

scheduleBatches(batches) member

Parameters:
  batches: [ BT ]

In your case it’s an array of MeasurementSeriesRepairJobOptions

#8

This is because you are calling doStart() instead of start(). The documentation for doStart states:

//This is the starting point of your batch job. This function will be invoked first by the batch engine.
//In this function, write logic to create & schedule batches {@link BatchJob#scheduleBatch}
// that should be distributed across the cluster.

Note that it is invoked by the batch engine and you implement it to do the right thing.

The start() function, however says:

//Starts the job with the supplied options.

So that is what you need to call to start the job.

2 Likes
#9

Thank you very much, it works