3 Replies Latest reply on Oct 22, 2018 11:37 AM by Justan Suss

    Can I add an 'interval' schedule to an Execution Task via BLCLI?

    Justan Suss
      Share:|

      Hi,

       

      I'm looking to add a schedule to an execution task with something like what's available when you add an 'interval' type schedule via GUI.

       

      Every 14 D 0H 0M starting 24-Oct-2018 6:30:00 PM

       

      Looking at the commands available for the Execution Task I see commands to add weekly, monthly or one time schedules.

       

      My REAL requirement is to create a bi-weekly schedule that begins in say, 9 days. I tried 'duping' the AddWeeklySchedule by setting a date in the future, but it seems that even when you pass the datestring it only reads the hhmmss of it.

       

      blcli_execute ExecutionTask addWeeklySchedule $et1DBKey "2099-01-01 23:35:00" "8" "2"

       

      gave me a schedule WEDNESDAY at 23:35:00 every 2 weeks - with next schedule coming 17-Oct-2018 at 11:35:00 PM.

       

       

      Any help or suggestions are appreciated.

      I just learned of the unreleased commands. I'm generating the help files for those now.

        • 1. Re: Can I add an 'interval' schedule to an Execution Task via BLCLI?
          Bill Robinson

          if you look at the unreleased commands for the ExecutionTask.addOneTimeSchedule you see what it calls:

          then look at what Job.addIntervalSchedule calls:

           

          so instead of calling the JobSchedule.setOnceDateTime, you'd call the JobSchedule.setInterval...  commands like in the Job version....

           

          this can be put into a custom xml in NSH/br/xml/cli or you can call the set of commands directly in your nsh script.

          • 2. Re: Can I add an 'interval' schedule to an Execution Task via BLCLI?
            Justan Suss

            Thanks Bill,

             

            I'm struggling to understand how to use commands from the 'job' or 'jobscheule' namespaces with the executiontasks.

             

             

            My script starts with

             

                 blcli_execute ExecutionTask getDBKeyByGroupAndName "/folder1/folder2" "ExecutionTask"

                 blcli_storeenv etkey

             

                 DATE_STRING="2018-10-24 18:30:00"

                 DAYS="14"

                 HOURS="0"

                 MINS="0"

             

            that's fine. - I can echo out the above variables as expected

             

            but I'm not sure how to get the command to work from there

             

                 blcli_execute ExecutionTask setIntervalDay $etkey "$DATE_STRING" "$DAYS" "$HOURS" "$MINS"

            errors out: 'setIntervalday' doesn't exist in executiontask namespace

             

                 blcli_execute JobSchedule setIntervalDay $etkey "$DATE_STRING" "$DAYS" "$HOURS" "$MINS"

            but it errors with: Found command 'JobSchedule.setIntervalDay' but with mismatching arguments

             

            I also tried using the addIntervalSchedule command (same syntax as above) with both the ExecutionTask and Job namespaces....

            as you'd expect - Found command 'Job.addIntervalSchedule' but with mismatching arguments.  AND ExecutionTask has no commands by name : addIntervalSchedule

            • 3. Re: Can I add an 'interval' schedule to an Execution Task via BLCLI?
              Justan Suss

              So, after posting my first reply above I revisted this. It took effort but we wound up getting it done.

               

              ICYMI here's what we came up with to add an interval type schedule that begins in a future date.

               

              NOTE 1 - my var declaration below - 'INTERVAL' is i days and I hard coded the '0' for hours and mins to suit my needs.

              NOTE 2: NOTE: Did not use the Utility.setinputastargetobject command eitehr.

              NOTE 3: blcli_execute Utility createModelObject JobSchedule - you MUST pass argument 'JobSchedule.'. Seems like "createModelObject" is less about object creation and more about defining a target namespace.

              NOTE 4: Sampple below assumes you already have the $etkey

              ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

               

              echo "*** ADDING THE BIWEEKLY SCHEDULE TO THE TASK ***"

              DATE_STRING="2036-09-21 18:30:00"

              INTERVAL="14"

               

              blcli_execute Utility stringToDate "$DATE_STRING"

              blcli_execute Utility setTargetObject

              blcli_execute Utility storeTargetObject scheduleDate

               

              ### Getting the ET ID of the Execution Task and then getting the JobKey ****"

              blcli_execute ExecutionTask findByDBKey $etkey

              blcli_execute ExecutionTask getExecutionTaskId

              blcli_execute Utility setTargetObject

              blcli_execute Utility storeTargetObject executionTaskId

              blcli_execute ExecutionTask getJobDbKeyByExecutionTaskId NAMED_OBJECT=executionTaskId

              blcli_storeenv jobKey

               

              # creating the 'JobSchedule' object

              blcli_execute Utility createModelObject JobSchedule

              blcli_execute JobSchedule setExecutionTask $etkey

              blcli_execute JobSchedule setStartTime NAMED_OBJECT=scheduleDate

              blcli_execute JobSchedule setIntervalDay $INTERVAL

              blcli_execute JobSchedule setIntervalHour 0

              blcli_execute JobSchedule setIntervalMinute 0

              blcli_execute JobSchedule setSchedFreqTypeId 5

              blcli_execute Schedule create

              blcli_execute JobSchedule getScheduleId