x
login Signup

Procedure that will edit a Scheduler's Frequency Date and Time

We currently have a scheduler that only runs once. When we need it to run we manually edit the frequency date and time.

Also have another procedure that will do it's own things, but the parameters for this procedure is the same as the scheduler's date and time to run but just two days earlier. Would it be possible to automatically set the Scheduler's frequency Date and Time based on the procedure or maybe a python script?

avatar image By cherrycool96 0 asked Mar 19 at 10:44 PM
more ▼
(comments are locked)
10|750 characters needed characters left

1 answer: sort voted first

Yes, this can be done using the modifySchedule API from ectool, ec-perl, ec-groovy or REST or using DSL. Here's an example of how to do what you described in DSL:

 project "Scheuduler Example",{
     procedure "Run Once Procedure",{
         formalParameter "Param1"
     }
     schedule "Run Once", beginDate: '2019-01-01', startTime: '00:00',
         projectName: "Scheuduler Example", procedureName: 'Run Once Procedure', actualParameter: ['Param1':'abc']
     procedure "Second Procedure",{
     step "Modify schedule", shell: "ectool evalDsl --dslFile '{0}'",command: '''\
         import groovy.time.TimeCategory
         now =  new Date()
         use( TimeCategory ) {
             after2hours = now + 2.hours
         }
         after2hours.toString()
         schedule "Run Once", projectName: "Scheuduler Example",
             beginDate: after2hours.format('yyyy-MM-dd'),
             endDate: after2hours.format('yyyy-MM-dd'),
             startTime: after2hours.format('HH:mm')
     '''.stripIndent()
     }
 }
 

This DSL code will create the procedure, "Run Once Procedure", and the schedule, "Run Once" that runs it. The "Second Procedure" uses DSL to modify the schedule to run 2 hours after this procedure is run.

avatar image By gregm 2k answered Mar 20 at 02:00 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.