18.10 Schedule Jobs
You can create a schedule for when a job should run. This example shows how to schedule a job to run immediately.
import logging
from datatransforms.schedule import Schedule,SCHEDULE_STATUS_ACTIVE
from datatransforms.workbench import DataTransformsWorkbench,WorkbenchConfig
logging.getLogger().setLevel(logging.ERROR)
#use params from config , dont hardcode passwords. Used for unit test only
pswd="<your deployment pswd from secret store>"
connect_params = WorkbenchConfig.get_workbench_config(pswd)
workbench = DataTransformsWorkbench()
workbench.connect_workbench(connect_params)
#schedule DemoWorkflow2 , at the earliest possible. default next miute.
#due to network and latency it is recommended to use default;
# however it can be customized with asap option.
#NOT recommended to go less than 5 seconds unless instance connectivity is fast (eg same network).
schedule = Schedule("test_schedule_immediate")\
.workflow(project="MyProject",workflow_name="Process SH Data")\
.immediate()\
.schedule_status(SCHEDULE_STATUS_ACTIVE)
workbench.save_schedule(schedule)
Parent topic: Python API for Oracle Data Transforms