AutoSys - Update common attribute in multiple JILs - autosys

Have scoured the net but was not able to find anything fruitful.
Assume that i have 5 boxes within 5 jobs within each.
I would want to update a common attribute within each one of those jobs.
Is there a way to perform the update to that attribute using a single update_job statement rather than having 25 lines of update_job commands for each job?
Zz

Yes,
you can just use for example:
update_job: job_name
condition: s(job_name1)
update_job: job_name_a
condition: s(job_name2)
update_job: job_name_b
condition: s(job_name3)
Dave

Related

Is it possible to get multiple values from XCOM for a single task at once in Airflow?

Is it possible to retrieve multiple values from XCOM, pushed by a single task but with different keys?
I think I've seen examples to this:
# pulls one value
pulled_value = ti.xcom_pull(key=None, task_ids='my_task_id')
and to this:
# pulls multiple values but from multiple tasks
pulled_value_1, pulled_value_2 = ti.xcom_pull(key=None, task_ids=['my_task_id_1', 'my_task_id_2'])
What I need is would possibly look like this:
# pulls multiple values but from a single
pulled_value_1, pulled_value_2 = ti.xcom_pull(key=['my_key_1', 'my_key_2'], task_ids='my_task_id')
I can't find this in the documentation.
Is this even possible?
If yes, it makes a single database query in the background, or just repeats a single query multiple times?
If not, how could I get similar behavior?
Answering your questions:
There is no such feature.
xcom_pull accepts task_ids: Optional[Union[str, Iterable[str]]] but with the same key. You can open a PR to Airflow for adding the functionality you seek.
As for number of queries: I assume that by "repeats a single query" you are asking if it execute a query per task_id. The answer is No. Airflow did this optimization in PR.
In the source code you can see that xcom_pull() uses Xcom.get_many() and get_many creates a filter using IN which allows to compare against multiple values. You can see the relevant code lines here.

Control-M out condition added with number at the end

We have a control-m jobs out condition to trigger the next successor jobs.
But, we could see the some numbers are getting added at that. What would be the check in the job settings need to add to get rid of number at the end.
Apart from ordering the control-m folder with the check "Order adependent Flow"
This can happen in 2 different scenarios;
When manually ordering a set of jobs and you specify "Order as Independent Flow" then Control-M adds these suffixes to prevent interference between the manually ordered jobs and pre-existing jobs.
In the Planning Domain/Links Setting - there is a setting called Create unique names for conditions - this will add a random number the the end of a condition where that condition already exists. However, if this option is disabled, and a condition with the same name is created, a single condition is linked to multiple destinations.
If you have access to the BMC documentation you can see this info here -
https://documents.bmc.com/supportu/9.0.18/help/Main_help/en-US/index.htm#11880.htm

create control-M job on the fly

Is it possible to dynamically create control-M jobs.
Here's what I want to do:
I want to create two jobs. First one I call a discovery job, the second one I call a template job.
The discovery job runs against some database and comes back with an array of parameters. I then want to start the template job for each element in the returned array passing in that element as a parameter. So if the discovery job returned [a1,a2,a3] I want to start the template job 3 times, first one with parameter a1, second with parameter a2 and third one with parameter a3.
Only when each of the template jobs finish successfully should the discovery job show as completed successfully. If one of the template job instances fails I should be able to manually retry that one instance and when it succeeds the Discovery job should become successful.
Is this possible ? And if so, how should this be done ?
Between the various components of Control-M this is possible.
The originating job will have an On/Do tab - this can perform subsequent actions based on the output of the first job. This can be set to work in various ways but it basically works on the principle of "do x if y happens". The 'y' can be job status (ok or not) exit code (0 or not) or text string in standard output (e.g. "system wants you to run 3 more jobs"). The 'x' can be a whole list of things too - demand in a job, add a specific condition, set variables.
You should check out the Auto Edit variables (I think they've changed the name of these in the latest versions) but these are your user defined variables (use the ctmvar utility to define/alter these). The variables can be defined for a specific job only or across your whole system.
If you don't get the degree of control you want then the next step would be to use the ctmcreate utility - this allows full on-the-fly job definition.
You can do it and the way I found that worked was to loop through a create script which then plugs in your variable name from your look-up. You can then do the same for the job number by using a counter to generate a job name such as adhoc0001, adhoc0002, etc. What I have done is to create n number of adhoc jobs as required by the query, order them into a new group and then once the group is complete send the downstream conditions on. If one fails then you can re-run it as normal. I use ctmcreate -input_file . Which works a treat.

Autosys Job holding in different boxes

Suppose we have some 400 jobs in different boxes then I want to put on hold the daily running jobs at 9-10 pm pm only?
Do you use WCC or command line?
In WCC you can just use a comma-separated list of jobs to see only the jobs you want. You can filter by status and select the jobs you want to take action on, then select 'change status' to do a sendevent but check off the 'future' box. Set it up so you send an 'on-hold' event at 9pm and again for an 'off-hold' at 10pm.
If you use command line you'll want to do something like below. Do all of your boxes have some naming conventions in common? If so you can run the command only once using the string that returns your boxes. In the AutoSys instance I work in we use a prefix structure...
To get the list of running jobs:
autorep -J prefix% | [find for windows or egrep for unix] " RU "
... Where you need the spaces between the double quotes and the two-letter status otherwise it would return lines where the item name contains those two characters.
To do a future sendevent use the usual sendevent syntax and just append the switches to indicate the time you want the action taken.
Will this accomplish what you're looking to do? If not please let us know if you're using windows or Unix as well as any additional information that can help us understand the specifics of your scenario.

IF SYNTAX AND EXAMPLE in CRM ON DEMAND

There are 3 picklists. If particular values are selected in 1st and 2nd picklist the 3rd picklist must be updated.
I have Written the following rule condition:
IIf(='BUILDING' AND ='RETAILS', 'BUIDLING', IIf(='BUILDING' AND ='RAILS','INFRA','INDUSTRY') )
This Condition gives me Invalid Expession Syntax.
A few things about CRMOD workflows:
A workflow condition are the specified conditions that must be met in order for the workflow to activate, if this is left blank it will activate everytime the trigger event(see below) happens e.g. If a record is created or modified.
a) Workflows are object specific e.g. Contact
b) The Trigger event inconjunction with the workflow condition above specifies when the workflow activates.
Once you have decided on your trigger then you have the option to select actions, this is where you would add the fields you want to update and specify the values.
You may find that you need more than one workflow depending on your business requirements.
I suggest you read the online user guide and oracle support resources to better understand the process before creating any automation in a product.
As for your If statement here is the syntax you need to follow:
IIf
The IIf function in Expression Builder returns one of two parameters based on the evaluation of a conditional expression. IIf is an abbreviation for Immediate If.
Syntax
IIf(expr, result_if_true, result_if_false)
Alternate Syntax
IIf(expr, expr_if_true, expr_if_false)
Mixed Syntax
IIf(expr, result_if_true, expr_if_false)
IIf(expr, expr_if_true, result_if_false)
E.g.
IIf([<PrimaryBillToState>]='OK' OR [<PrimaryBillToState>]='TX', 'Central', IIf([<PrimaryBillToState>]='CA', 'West', 'East'))
Kind Regards
Simon

Resources