...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
... <Script language="javascript"><![CDATA[1000]]></Script> ... |
Calculation
Calculation
The calculation result is the time in seconds for the specific Minimum
or Maximum
definition. .
This example calculate the execution time dependend of the %file_size%
parameter, that was set by a specific job (see the example below)´.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
... <!-- This calculation is dependent of the %file size% parameter, that was set by a specific job --> <Script language="javascript"><![CDATA[ function my_calculate(){ var fileSize = new java.lang.Double(%file_size%); var timerExpiryFactor = 0.0025; var timerExpiryTolerance = timerExpiryFactor*0.1; var timerExpiry = new java.lang.Double(timerExpiryFactor+timerExpiryTolerance); timerExpiry = timerExpiry*fileSize; return timerExpiry; } my_calculate(); ]]></Script> ... |
This example job calculate and create a new order parameter file_size
.
To store the parameters into database (table SCHEDULER_MON_RESULTS
) :
- set the
scheduler_notification_result_parameters
parameter (see job documentationjobs/JobSchedulerNotificationStoreResultsJob.xml
) - set the
com.sos.scheduler.notification.jobs.result.StoreResultsJobJSAdapterClass
as monitor
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- This job calculate and create a new order parameter file_size. If the StoreResultsJobJSAdapterClass is defined as monitor, this parameter will be stored in the database (table SCHEDULER_MON_RESULTS) --> <job title="Sample Job with Store Result Monitor" order="yes" stop_on_error="no" tasks="1"> <settings><log_level><![CDATA[info]]></log_level></settings> <description><include file="jobs/JobSchedulerNotificationStoreResultsJob.xml"/></description> <params> <!-- Parameter scheduler_notification_result_parameters (see job documentation jobs/JobSchedulerNotificationStoreResultsJob.xml) defines which parameter is to be stored in the database. If this parameter is not set - all order parameters are stored. --> <param name="scheduler_notification_result_parameters" value="file_size"/> </params> <script language="javascript"><![CDATA[ function spooler_process(){ var order = spooler_task.order; var params = spooler.create_variable_set(); params.merge(spooler_task.params); params.merge(order.params); var file = new java.io.File(params.value("scheduler_file_path")); var fileSize = file.length()/1024; order.params.set_var("file_size",fileSize.toString()); return true; }]]> </script> return timerExpiry; <!-- set StoreResultsJobJSAdapterClass as monitor to store parameters into the database --> <monitor }name="notification_monitor" ordering="1"> <script java_class="com.sos.scheduler.notification.jobs.result.StoreResultsJobJSAdapterClass" language="java"/> </monitor> my_calculate(); ]]></Script> ...<run_time /> </job> |
Message
Usage
The Message can be configured on the following parent nodes as CDATA element :
...
- System Monitor: The step of notifying JobScheduler through an acknowledgement in the System Monitor is an execution of a script. This is nothing else than a notification, like sending a mail for instance, but instead, another action is executed, which is the execution of the script that contacts JobScheduler and add an order to the JobChain
ResetNotifications
described above.