Posttask and postjob blocks
After a PDriver task or job runs, you might want to run code to do some postprocessing. For example, you can use posttask blocks to clean up the state on the Engine. You can use the postjob blocks to move results to other locations. Like the pretask and prejob blocks, simply surround your code with a posttask or postjob keyword at the beginning, and an end keyword at the end. Locate both blocks of code after the task block in your PDS script.
Code in the posttask block runs on each Engine after the job completes, while code in the postjob block runs once on the Driver. One important difference in the posttask and postjob blocks is when they are executed. The posttask block happens after all of the tasks are completed. There’s no guarantee that they happen immediately after the tasks are done, but they finish before the job ends. If you are running your job synchronously, the postjob block runs when the job finishes. And if you used pdriver -bsub to submit a job, the postjob block runs when you collect the results.