Setting up schedules for jobs

You can set up schedules to run jobs such as report jobs, export jobs, and import jobs.

Procedure

Set up a schedule. Use any one of the following methods: user interface, Java™ API, or script API.
Option Description
User interface
  1. Click Data Model Manager > Scheduler > Jobs Console.
  2. Specify the schedule you want your job to run.
Java API
Sample 1: The following sample Java API sets ups a schedule for a job. Java API has only one method of setting up a schedule for any kind of job (import, export or report).
Context ctx = PIMContextFactory.getCurrentContext();
JobManager manager = ctx.getJobManager;
Job job = manager.getJob(jobName);
Date date = new Date(new Date().getTime() + 3600000L);
Schedule schedule = manager.createSchedule(job, sample_schedule, Schedule.Type.DAILY, date);

//creates schedule with the name sample schedule of type Daily for the job which starts at the given time "date".
Sample 2: The following sample Java API sets up an immediate schedule for a job by taking the job name from job description.
Schedule schedule = manager.createSchedule(job);
//creates an immediate schedule taking 
//the name from job description
Sample 3: The following sample Java API sets up a job schedule of given type using current time as the next running time.
Schedule schedule = manager.createSchedule(job, sample_schedule, Schedule.Type.ONE_TIME);

//creates a schedule of given type 
//using current time as the next running time
Script API
Sample 1: The following sample script API starts a schedule for running a report job.
var attr_JobName = “My Report”;
var attr_JobType = “REPORTEXE”;
var scheduleID = runJob(attr_JobName,attr_JobType);
out.writeln(scheduleID);
Sample 2: The following sample script starts a schedule for running an export job.
var attr_Export = "SchedulerTestBasicCtgExport";
var s = startExportByName(attr_Export);
out.writeln(s); 
Sample 3: The following sample script starts a schedule for running an import job.
var attr_Import = “SampleImport”;
var attr_DocPath = “feed_files/file.csv”;
var s = startAggregationByName(attr_Import, attr_DocPath);
out.writeln(s);