Reputation: 24659
I would like to run a batch application (that is a short lived process that should not be restarted) on Pivotal CloudFoundry.
I am not sure how to do that. My current batch app is restarted repeatedly by Pivotal CF.
It seems there's a new CF primitive called a task - as opposed to a long-running process. Tasks are supposed to be available on CF 1.7 (see https://stackoverflow.com/a/35512113/536299).
I was neither able to find relevant information in the CF documentation nor to figure out which version of the Pivotal CF is currently being run...
Can someone please help?
Upvotes: 2
Views: 2216
Reputation: 24659
I just got relevant information regarding short-lived/one-off processes on CF. It currently seems to be very difficult to run short-lived/one-off processes on CF.
This will change when CF v3's tasks becomes generally available.
Here is the information I was given:
Batch jobs are a little tricky on PWS and PCF because at the moment the platform expects your application to continue running forever. Even if the app exits successfully, the platform considers it to have crashed and will restart it. There is support in v3 of the platform for one-off tasks like batch jobs, so this will get easier in the future. For now, what you need to do is to make the app run forever. One option is to add a loop to the main method in the app, the loop would essentially run the batch job, pause for some set amount of time and repeat indefinitely.
So bottom-line is wait for CF v3's tasks.
See here for documentation about tasks: http://v3-apidocs.cloudfoundry.org/version/release-candidate/index.html#tasks
Upvotes: 2