Anyone who has tried to run a batch application either through Spring Cloud Task or Spring Batch Job on PCF knows the pain of running the application on it and doing scheduling. To date, PCF has been considered only as a means to run “web” process types of applications, where there is no room for “Batch” Process types, as there was no built-in scheduler available. But, with PCF 2.0, a very nice service called “PCF Scheduler” was introduced. This can help with the running of a Batch Application, as per the defined schedule.
* Scheduler for PCF is a service for scheduling the execution of Diego tasks, such as database migrations, emails, or batch jobs, as well as the execution of outbound HTTP calls.
* It is a Marketplace Service which has to be bound to a PCF application and then, using it, scheduled jobs and calls can be defined to run for this application.
* Commands for the jobs will be run on the VM where the PCF application is running, which basically limits the functionality of it to be around the application only.
What You Will Build Here
* Create, run, and schedule jobs and view job history.
* Create, run, and schedule calls and view call history.
What You Will Need
* JDK 1.8
* Gradle
* CF CLI
* Scheduler for PCF CLI plugin on your local workstation (required for the create call, as it’s available only through the CF CLI). This plugin is required to execute the commands related to the create/run/schedule call. It can be downloaded from Pivotal Network (https://network.pivotal.io/products/p-scheduler/). The command to install plugin is as follows:
cf install-plugin scheduler-for-pcf-cliplugin-windows32-exe-1.1.0
1. How to Create Jobs Using Scheduler
* Get a sample Spring Boot application. You can use this Spring Cloud Task Batch application (https://github.com/RajeshBhojwani/spring-batch-job.git).
* Push this application to PCF. The above sample app has a manifest.yml file, so cf push will be sufficient to push the app to PCF.
* Once the application starts running, stop the application as it will crash after running through all the steps of the Batch Job.
* Now a job can be created on this application using PCF Scheduler. https://goo.gl/cXtBgn #DataIntegration #ML
Share this:
- Click to share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to email a link to a friend (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Click to share on Pinterest (Opens in new window)
- Click to share on Reddit (Opens in new window)