Scheduled tasks launch
Scheduled tasks can be launch in different maner, however, whatever the way used, scheduled tasks should be launch with HPA Agent.
Do not instrumentate very short ST with complete profile :
HPA Agent can have an overhead of 10 to 20 seconds at startup depending of the classpath length.
ST that ran during less than one minute will have a big overheadUse the basic profile (memory monitoring only) for those ones
ST launched by a script
If a shell script is launching the Scheduled task JVM (and not sending an event to trigger the scheduled tasks). The procedure is quite similar to engines :
Identify the script used to launch the component, it can be the default or a custom script.
You can use Help > Agent wizard in the portal to help you defining the right values
Add the following lines in the startup scripts :
- Agent name :
ScheduledTask-<uniqueIdentifier>
- Agent profile :
scheduletasks
orscheduletask_basic
(i.e ScheduledTask-and scheduletasks, see agent name and profile) Use a unique identifier in the agent name that can be chosen from the script context, the external ref for example.
# HPA start modification
if [ -r {{hpa_agent_dir}}/hpa_agent_common.sh ]; then
source {{hpa_agent_dir}}/hpa_agent_common.sh "<Agent name>" "<profile>"
fi
# HPA end modification
The lines must be included :
- either at the beginning of the default/custom script
- either in a parent script
- either before the call to
java
ST launched by Scheduler
Scheduled tasks are also launched by schedule server based on database, in this case, the JVM arguments of the scheduled task is stored in the database.
Two options here :
1) Activate the ST auto-monitoring feature
This feature is disabled by default.
This feature add the required parameters on the fly when the Calypso job start only if Scheduler is, itself, already monitored
Unlike the others parts, this extension modify Calypso execution to add the HPA parameters.
Activate the auto-monitoring
To activate it, create the file {{hpa_agent_dir}}/wily/core/config/hpacustomer/activate_st_monitoring.pbd
with the following line :
SetFlag: HpaSchedulerTasksAutoMonitoring
TurnOn: HpaSchedulerTasksAutoMonitoring
Reference this file in the customer configuration.
Edit {{hpa_agent_dir}}/wily/core/config/hpacustomer/hpa_customerconfig.pbl
and append the line activate_st_monitoring.pbd
.
Example :
#####
# Add here your custom directives.
# Be sure to valide it with Hexagon support team
# Example : custom_metric.pbd
# Example : other_set_of_custom_metrics.pbd
<... add your customization here ...>
activate_st_monitoring.pbd
These files are not overwritten when you deploy a new agent.
Configure the auto-monitoring
Each time a scheduled task is launched by Schedule Server, this feature checks if the external reference of the Scheduled task is listed in the configuration file.
The configuration file is reloaded every 2mn if needed.
Configuration file is :
{{hpa_agent_dir}}/automatic_st_monitoring.list
This file is not overwritten when you deploy a new agent.
If the file does not exists, use the template :
cp {{hpa_agent_dir}}/automatic_st_monitoring.list.template {{hpa_agent_dir}}/automatic_st_monitoring.list
or if the template does not exists, create the file with this content :
// You can comment
// line pattern is <regular expression>;;<profile>
// profile can be : scheduletasks (full monitoring) or scheduletasks_basic (only cpu / memory / gc, no overhead)
EXAMPLE_HPA_MY_EXTERNAL_REF.*;;scheduletasks
// the token HPA_MONITOR_ALL is used as a default value if present
// if not present, default action is to do not add monitoring on ST
HPA_MONITOR_ALL;;scheduletasks_basic
The lines are evaluated in order, add as much lines as needed. Evaluation stops when a pattern match.
- 1st part of the line is a regular expression that must match the external reference of the scheduled task.
- 2nd part is the profile to apply :
scheduletasks
orscheduletasks_basic
If the constant HPA_MONITOR_ALL
is present in the file and the no other lines match previously then this default profile is applied.
If the constant is not found, and the external reference did not match any line, there is no monitoring added.
Keep HPA_MONITOR_ALL
on the last line.
Select the ST to monitor
The full monitoring is scheduletasks
: usual overhead with full range of metrics and functions.
The basic monitoring is scheduletasks_basic
: no overhead in launch time or execution time. Only CPU, GC, and memory metrics.
Logs
This feature trace the new parameters added to the scheduled tasks in the Schedule Server agent file, usually :
{{hpa_agent_dir}}/wily/logs/IntroscopeAgent-HpaGenericSchedulerServer.log
2) Add HPA parameters in the JAVA OPTIONS (not recommended)
Using the Calypso GUI or directly in the database, add the Java parameters in the JAVA_OPTIONS argument of the scheduled task (same place as the memory options usually)
Why it is not recommended ?
When a database is copied to another environment, ST parameters that have been added in this way will have a wrong environment name
Worse ! it could prevent the start of the ST if agent is not present. This solution requires a strong automated deployment system to update every parameters on each deployment
You can use Help > Agent wizard in the portal to help you defining the right values