Automic Workload Automation

  • 1.  How to Replace jobs dynamically in For Each Workflow

    Posted Jun 28, 2018 03:14 PM

    Hello Team,

     

    Can we replace jobs dynamically in a For-Each Workflow?

    I have created a for each workflow and want to place one unix job inside it.

    I am curious to know can we replace the single job dynamically based on the selection of job in a promptset.

     

    I tried using Modify_task in the script object and activated the workflow but it didn't replace the task at run time. Please find the script written in the script object.

     

    :SET &ACTOBJ# = ACTIVATE_UC_OBJECT(JOBP.ORCHESTRA)

    :SET &TNR# = GET_UC_OBJECT_NR("JOBP.ORCHESTRA")

    :SET &RETSTOP# = MODIFY_TASK(&TNR#, STOP_MODIFY)

    :SET &RET# = MODIFY_TASK(&TNR#, "JOBS.UNIX.NEW.1",, REPLACE_TASK, "JOBS.UNIX.NEW.2", EXTERNAL) :SET &RETCOMMIT# = MODIFY_TASK(&TNR#, COMMIT) :SET &RETGO# = MODIFY_TASK(&TNR#, GO)

     

    And I noticed this statement in the activation report of the script object.

    U00011107 Task 'JOBP.ORCHESTRA' ('0001037021') is not stopped - GO not possible.

     

    Please let me know where did I go wrong?

     

    Thanks,

    Srujan



  • 2.  Re: How to Replace jobs dynamically in For Each Workflow

    Posted Jun 28, 2018 03:40 PM

    The use of MODIFY_TASK() can be tricky.  As your error message suggests, you must also issue a STOP and START against the object in order to be able to modify it while it is in flight.

     

    How about a different way of solving your problem;

    1. Set up a different FOR EACH workflow for each job you want to be able to select.

    2. Build a new workflow that uses a promptset to select the desired job.

    3. Put all of the FOR EACH workflows inside of this new workflow, but also add a precondition rule onto each of their task properties to check your promptset variable to decide if the task should run or be skipped.



  • 3.  Re: How to Replace jobs dynamically in For Each Workflow

    Posted Jul 24, 2018 12:39 PM

    Hi,

     

    Thank you so much for the idea. But I guess it won't suit for my usecase as I need to place hundreds of Foreach workflows inside a Standard workflow.

     

    Our Requirement :  We have hundreds of scripts(shell, perl, python) which are used to automate operational tasks. So the user will be asked to give the list of agents on which the selected script should run on. So our idea is to create multiple job objects for all the scripts and will place the script inside :External_Interpreter of each job. Now, we create a workflow that will ask the user to enter the list of agents and the job/script that should run on all the agents. We also want to place agents in the Static Vara dynamically and we use this VARA to loop the For-each object. 

     

    Hope you understand our idea and appreciate if you suggest us any other interesting ideas.

     

    Thanks,

    Srujan.