scheduled tasks - sos berlin scheduler -- job chain - how to trigger other job after job timeout -
i'm using sos berlin scheduler (version linux-x64 1.10.5).
normally when job in job_chain timeout, scheduler kill job process , send email. so, based on this, want trigger other job. but, have tried 2 ways doesn't work.
way 1:
add function “spooler_task_after()” in job.
i guess failure because job create process on linux system, while job timeout scheduler kill job process, kill function “spooler_task_after()”
code:
<job timeout="00:00:09"> <script language="shell"><![cdata[ echo aa sleep 10s echo bb ]]></script> <monitor name="exit_code" ordering="0"> <script language="java:javascript"><![cdata[ function spooler_task_after(){ var exitcode = spooler_task.exit_code; spooler_log.info ("exit code is: " + exitcode); /* call other job */ result = true; return result; } ]]></script> </monitor> <run_time/> </job>
result:
2017-07-27 21:22:21.251+0800 [info] 2017-07-27 21:22:21.251+0800 [info] task sample_errorhandling/job1:23026 - protocol starts in /httx/opt/sos-scheduler/ldw-scheduler-test1/logs/task.sample_errorhandling,job1.log 2017-07-27 21:22:21.250+0800 [info] scheduler-842 task going process order sample_errorhandling/job_chain3:12, state=aaa, on jobscheduler 'http://xxxx:4444', order's process_class 2017-07-27 21:22:21.268+0800 [info] scheduler-726 task runs on jobscheduler 'http://jt-host-kvm-72:4444' 2017-07-27 21:22:21.268+0800 [info] scheduler-918 state=starting (at=never) 2017-07-27 21:22:22.466+0800 [info] scheduler-987 starting process: '/bin/sh' '-c' '"/tmp/admin/sos.gbdcm8"' 2017-07-27 21:22:23.520+0800 [info] [stdout] aa 2017-07-27 21:22:30.326+0800 [error] scheduler-272 terminating task after reaching deadline <job timeout="9"> 2017-07-27 21:22:30.359+0800 [error] scheduler-202 connection task has been lost, state=running_remote_process: z-remote-101 separate process: pid=0: connection lost / zschimmer::com::object_server::connection::pop_operation 2017-07-27 21:22:30.359+0800 [error] scheduler-202 connection task has been lost, state=release: z-remote-122 separate process pid=0: caller has killed process 2017-07-27 21:22:30.384+0800 [error] scheduler-280 process terminated exit code 1 (0x63) 2017-07-27 21:22:30.384+0800 [warn] scheduler-845 task ended without processing order. order remains in job's order queue in same state 2017-07-27 21:22:30.384+0800 [info] scheduler-843 task has ended processing of order sample_errorhandling/job_chain3:12, state=aaa, on jobscheduler 'http:/xxxx:4444'
way 2:
add return code on job chain node
this way works on job execute or error. failed when job killed timeout.
code in job chain:
<job_chain > <job_chain_node state="aaa" job="job1" next_state="success" error_state="error"> <on_return_codes > <on_return_code return_code="1"> <add_order xmlns="https://jobscheduler-plugins.sos-berlin.com/nodeorderplugin" job_chain="/error_handling/sendmail"/> </on_return_code> </on_return_codes> </job_chain_node> <job_chain_node state="success"/> <job_chain_node state="error"/> </job_chain>
Comments
Post a Comment