x
login Signup

How to pass a timeout value in the ElectricCommander createJobStep API?

In the createJobStep API, how can I pass a timeout value. Some documentation says timeLimit and timeLimitUnits should be set. I need to send timeout value but I don't understand how to pass timeLimitUnits as this is enum. The following does not work:

 $batch->createJobStep({ 
 parallel => '1',
 subproject=> 'ProjectName',subprocedure => 'ProcName',
 timeLimit => '10', timeLimitUnits => 'seconds'
 })

avatar image By amalviya 0 asked Apr 19 at 06:30 PM
more ▼
(comments are locked)
avatar image eric melski ♦♦ Apr 19 at 06:30 PM

What error do you get when you try the code you showed?

10|750 characters needed characters left

1 answer: sort voted first

I'm not seeing any error with the code you provided. Here's my test example DSL:

 project "Test", {
     procedure "Job to run",{
             step "step to run", command: "sleep 20", timeLimit: "30", timeLimitUnits: "seconds"
         }
     procedure "Job Step - ectool", {
         step "Create Job Step", command: '''\
             ectool createJobStep --parallel 1 --subproject Test --subprocedure "Job to run" --timeLimit 10 --timeLimitUnits 'seconds'
         '''.stripIndent()
         }
     procedure "Job Step - ec-perl", {
         step "Create Job Step", shell: "ec-perl", command: '''\
             use ElectricCommander;
             $| = 1;
             my $batch = new ElectricCommander();
             $batch->createJobStep({ 
                 parallel => '1',
                 subproject=> 'Test',subprocedure => 'Job to run',
                 timeLimit => '10', timeLimitUnits => 'seconds'
             })
         '''.stripIndent()
     } // procedure
 } // project
 

However, it appears the timeLimit value is not being applied to to the created step:

 ectool generateDsl --path "/jobSteps/a2bff0e9-4966-11e8-8f89-080027f0c6d5"
 
 jobStep {
   stepName = 'step to run'
   alwaysRun = '0'
   broadcast = '0'
   comment = null
   condition = '1'
   errorHandling = 'failProcedure'
   exclusiveMode = 'none'
   external = '0'
   logFileName = null
   outcomeReasonCode = null
   parallel = '0'
   postProcessor = null
   precondition = null
   procedureName = 'Job to run'
   processStepType = null
   projectName = 'Test'
   releaseMode = 'none'
   resourceName = null
   shell = null
   status = 'completed'
   subprocedure = null
   subproject = null
   timeLimit = '30'
   workingDirectory = null
   workspaceName = 'default'
 }
 

I'll report this as a possible bug.

avatar image By gregm 2k answered Apr 26 at 03:37 PM
more ▼
(comments are locked)
10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.