Automic Workload Automation

 View Only

 How to reset a scheduled task through a script.

Jump to Best Answer
Aravindan T's profile image
Aravindan T posted Aug 01, 2022 05:12 AM
Hi Team,

After the unplanned outage. We are manually resetting the task of the scheduled jobs which is taking more manual efforts. Can we able to do through a automated script ?
Dominic Irudayasamy's profile image
Dominic Irudayasamy Best Answer
I could not write the instruction on the msg box, so  I attached it in a txt file. Please refer it
Attachment  View in library
instr.txt 755 B
Peter Grundler's profile image
Broadcom Partner Peter Grundler
Hi Aravindan,

in order to recommend sth. kindly please explain the steps you perform after an outage.

regards,
Peter
Dominic Irudayasamy's profile image
Dominic Irudayasamy
After the maintenance, I created a simple script to reset the tasks in SCH objects.I am using the Jython script to do the task. Download and extract the scripts, update your AE connection details in  loginout_test.py (myconn = Connection.open("automic-ae-test.xxx.com", 2217), Update the line in Schedulemonitor.py script with your desired error, I reset the task which ended timeout.

if str(result.getStatusText()).startswith ("ENDED_TIMEOUT - Start time exceeded") and str(result.getStatusCode()) == "1941":
Copy your current version of the uc4.jar file to the same dir where you extract the scripts and download the "jython-standalone-2.7.2.jar" from jython site.

run the command from your windows command prompt
java -jar jython-standalone-2.7.2.jar ResetTask.py

It will ask for your userid password and DEP ,client details . you can modify it whatever you want.

if you know java API program then it will be easy.


Attachment  View in library
Dominic Irudayasamy's profile image
Dominic Irudayasamy
It can be achieved by the JAVA API program, but I am using Jython to dot it. If you still interested, I will share my script
Aravindan T's profile image
Aravindan T
Dominic Irudayasamy's profile image
Dominic Irudayasamy
Are you able to download it?
Attachment  View in library
Dominic Irudayasamy's profile image
Dominic Irudayasamy
once download the zip file , extract it one folder then update the loginout_test.py with your AE connection string(myconn = Connection.open("automic-ae-test.xxx.com", 2217), update the schedulemonitor.py script with your error string (if str(result.getStatusText()).startswith ("ENDED_TIMEOUT - Start time exceeded") and str(result.getStatusCode()) == "1941":)

Copy your current uc4.jar file to the scripts extracted folder and download the jython-standalone-2.7.2.jar from jython portal.

Open windows cmd go the dir and run the following command.

java -jar jython-standalone-2.7.2.jar ResetTask.py

Note: it will reset the task in all scheduled objects in the particular client which you enter in the input.

My schedule objects naming convention is xxxx.xxx.SCH(ex SCHEDULE.TEST.SCH) so that I mention the *.SCH in the ResetTask.py script(
taskfilter.setObjectName("*.SCH")) you can modify it according to your naming convention.
Dominic Irudayasamy's profile image
Dominic Irudayasamy
Once you download the scripts, extract them into a folder.
then update your connection string details in loginout_test.py(myconn = Connection.open("automic-ae-test.dhl.com", 2217),
update the scedulemonitor.py with your interested error string(
if str(result.getStatusText()).startswith ("ENDED_TIMEOUT - Start time exceeded") and str(result.getStatusCode()) == "1941":),
update the ResetTask.py with your schedule objects naming convention(
taskfilter.setObjectName("*.SCH"), our schedule objects end with xxx.xxx.xxx.SCH

Copy the current uc4.jar file to the folder
download the jython-standalone-2.7.2.jar from jython portal.

open window cmd
go to the extracted folder, run following command
java -jar jython-standalone-2.7.2.jar ResetTask.py
Dominic Irudayasamy's profile image
Dominic Irudayasamy
Once you download the scripts, extract them into a folder.
then update your connection string details in loginout_test.py(myconn = Connection.open("automic-ae-test.xxx.com", 2217),
update the scedulemonitor.py with your interested error string(if str(result.getStatusText()).startswith ("ENDED_TIMEOUT - Start time exceeded") and str(result.getStatusCode()) == "1941":),
update the ResetTask.py with your schedule objects naming convention(taskfilter.setObjectName("*.SCH"), our schedule objects end with xxx.xxx.xxx.SCH

Copy the current uc4.jar file to the folder
download the jython-standalone-2.7.2.jar from jython portal.

open window cmd
go to the extracted folder, run following command
java -jar jython-standalone-2.7.2.jar ResetTask.py
Dominic Irudayasamy's profile image
Dominic Irudayasamy
Once you download the scripts, extract them into a folder.
then update your connection string details in loginout_test(myconn = Connection.open("automic-ae-test.xxx.com", 2217),
update the scedulemonitor with your interested error string(if str(result.getStatusText()).startswith ("ENDED_TIMEOUT - Start time exceeded") and str(result.getStatusCode()) == "1941":),
update the ResetTask with your schedule objects naming convention(taskfilter.setObjectName("*.SCH"), our schedule objects end with xxx.xxx.xxx.SCH
Copy the current uc4.jar file to the folder
download the jython-standalone-2.7.2.jar from jython portal.
open window cmd
go to the extracted folder, run following command
java -jar jython-standalone-2.7.2.jar ResetTask.py
Aravindan T's profile image
Aravindan T
@dominic​ Thanks a lot for your guidance & help.
Aravindan T's profile image
Aravindan T
Hi All,

Can anybody share us the automic script for doing these steps.