When Studio Server Jobs enter the Server Job queue, they will stay there indefinitely.
When the queue holds too many Jobs though, the performance of database queries can be negatively affected and the overview of Jobs in the Job Queue becomes difficult to manage.
It is therefore important to clean up the queue on a regular basis. This can be done either manually or automatically.
Figure: The Studio Server Job Queue page with multiple Server Jobs listed.
Deleting Jobs manually
Step 1. In Studio Server, access the Studio Server Job Queue page.
Step 1a. Click Integrations in the Maintenance menu or on the Home page.
Step 1b. In the Studio Server Jobs section, click Job Queue. The Studio Server Job Queue page appears.
Step 2. Select the check box in front of one or more Server Jobs that need to be deleted.
Tip: To select all Jobs on the page, click Select All at the bottom of the page.
Step 3. At the bottom of the page click Delete Selected and confirm the action.
The selected Jobs are deleted.
Deleting Jobs automatically
Studio Server Jobs can be automatically and periodically cleaned up by Studio Server. This is done by configuring the Studio Server Job named "AutoCleanServerJobs".
Step 1. Access the Studio Server Job Config page.
Step 1a. In Studio Server, click Integrations in the Maintenance menu or on the Home page.
Step 1b. In the Studio Server Jobs section, click Job Configurations. The Studio Server Job Config page appears.
Step 2. Click AutoCleanServerJobs.
The configuration page for that Job appears.
Step 3. Set its options:
- Attempts: Enter a number which specifies how many attempts should be made to re-try the job until running the job should be canceled.
- Username: Choose a user with system admin privileges.
- Active: Select to activate this job.
Step 4. Click Update.
Step 5. Configure after how many days the Job should run and (optionally) which Jobs should be deleted by doing the following:
Info: The described step can only be performed on the on-premise version of Studio Server, not on the cloud version.
Step 5a. In the configserver.php file (recommended: config_overrule.php file) for Studio Server, locate the Studio Server Job Auto Cleanup section.
<Studio Server path>/config
// ---------------------------------------------------------------------- // Studio Server Job Auto Cleanup // ---------------------------------------------------------------------- // Automatically deletes Studio Server Jobs of a particular status // when they become older than a specified number of days. // AUTOCLEAN_SERVERJOBS_COMPLETED: // Deletes Studio Server Jobs of status 'Completed'. // Default value is 14 days, which means all completed jobs in the // queue that are older than 14 days will be deleted. // When set to zero (0), this feature is disabled. define( 'AUTOCLEAN_SERVERJOBS_COMPLETED', 14 ); // AUTOCLEAN_SERVERJOBS_UNFINISHED: // Deletes Studio Server Jobs that have a status other than // 'Completed'. Default value is 30 days, which means all jobs // in the queue that were never picked up, failed or not completed // for some reason, and that are older than 30 days will be deleted. // When set to zero (0), this feature is disabled. define( 'AUTOCLEAN_SERVERJOBS_UNFINISHED', 30 );
Step 5b. Do one of the following:
- To delete Studio Server jobs of all statuses (such as "Completed", or "Planned"), configure the time interval (in days) for
- To only delete Studio Server jobs that have a "Completed" status, configure the time interval (in days) for
- To only delete Studio Server jobs that have a status other than "Completed", configure the time interval (in days) for
Tip: Set either option to 0 (zero) to disable it.
Step 6. Make sure that a Studio Server instance is set up to handle the AutoCleanServerJobs Server Job.
Step 6a. Access the Studio Server Maintenance page for the Studio Server instance.
Step 1. Click Integrations in the Maintenance menu or on the Home page.
Step 2. In the Studio Server Jobs section, click Studio Servers. The Studio Servers page appears.
Step 3. Create a new instance or click an existing one. The Studio Server Maintenance page appears.
Step 6b. Set the "Handle Jobs" option to All or choose Specified and choose AutoCleanServerJobs from the list.
Note: For more information about setting up Studio Server instances, see Working with Studio Server Jobs in Studio Server.
Step 7. Set up a recurring Job schedule as explained in Working with Studio Server Jobs in Studio Server. Make sure to use the following cURL argument: "http://127.0.0.1/StudioServer/jobindex.php?createrecurringjob=AutoCleanServerJobs".
Example: To create an AutoCleanServerJobs job in the Studio Server Jobs queue at 23:00h on weekdays only, to be picked up by any of the listed servers, use the following time schedule: Hours: 23, Minutes: 0, Days of the week: 1,2,3,4,5, Months: *, Days of the month: *.
Step 8. Run the Server Jobs test on the Health Check page for Studio Server.
Step 8a. Click Advanced in the Maintenance menu or on the Home page.
Step 8b. Click Health Check.
The Health Check page appears.
Step 8c. At the bottom of the page, click Clear All.
Step 8c. Only select the test named Server Jobs and click Test.