Date: Fri, 29 Mar 2024 02:33:44 +0000 (UTC) Message-ID: <1042495341.12279.1711679624215@change.sos-berlin.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_12278_1472313639.1711679624215" ------=_Part_12278_1472313639.1711679624215 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
I would like to emulate an AutoSys=C2=AE max_exit_success
. =
For example, a max_exit_success=3D10
means that
For a job chain this would mean:
I tried to change the error_state with a next_state but this did not wor= k. Could you give me a hint?
You can find instructions about handling exit codes on our How to conf= igure the handling of exit codes by jobs page.
Here is another example:
function= spooler_task_after() { =20 var rc =3D spooler_task.exit_code; var next_state =3D spooler_task.order().job_chain_node().next_state(); spooler_log.info( "INFO: Job has ended with exit code " + rc ); switch( rc ) { case 0 : break; case 1 : spooler_log.error("suspend order"); spooler_task.order().set_suspended( true ); break; case 5 : // the job is required to have a setback configuration spooler_log.error("setback order"); spooler_task.order.setback(); break; case 10 : spooler_log.warn("INFO: Please check results and content, R= EPORT MAY BE AFFECTED"); spooler_log.info("order state changed to " + next_state); spooler_task.order.state =3D next_state; break; case 15 : spooler_log.warn("INFO: Please check results and content. T= HERE ARE REJECTS"); spooler_log.info("order state changed to " + next_state); spooler_task.order.set_state( next_state ); break; =20 default : spooler_log.info("order state changed to " + next_state); spooler_task.order.set_state( next_state ); break; } }
A possible solution in PerlScript could be:
if ($spo= oler_task->params->var("max_exit_success")>0) { my $max_exit =3D $spooler_task->params->var("max_exit_success= "); $spooler_log->info( " Max exit success : $max_exit" ); if ($spooler_task->exit_code =3D=3D 0) { $spooler_log->info( "--> SUCCESS "); } elsif ($spooler_task->exit_code > $max_exit) { $spooler_log->info( "--> ERROR "); $spooler_log->info( "Error state : ".$chain_node->error_= state ); } else { $spooler_log->warn( "--> WARNING "); $spooler_log->info( "Next state : ".$chain_node->next_st= ate ); $order->LetProperty( 'state', $chain_node->next_state ); } $order->LetProperty( 'state_text', '=3D=3D=3D Exit code '.$spool= er_task->exit_code.' =3D=3D=3D' ); }