Extensis Logo SUPPORT | FORUMS | KNOWLEDGE BASE

Portfolio API Pitfalls: Clean up after your Jobs


#1

Portfolio Server, and the the Portfolio API, allows you to perform a number of transformations upon your files. From renaming to resizing to converting to a different format, you can put your files through a number of changes. Once complete, some of these Jobs can be downloaded from the server, depending on how you configured the it.

If you are doing this in the Web Client, you can clear the list of available Jobs if it is getting to long. But if you are using the Portfolio API, a long list of Jobs could be growing, and you would not be aware of it unless you built an interface monitoring it.

If you are creating Fire and Forget jobs, a job that automatically processes a file and downloads it, you should clean up each Job after it is complete. Performing ten such jobs without cleaning up will not be a problem, performing 100 will be fine. Perform 1000 and you are going to start having performance issues. With Catalogs that number in the hundreds of thousands, it can be easy to start a process that will overwhelm your server.

It can all be prevented with a couple lines of code.

PHP

$cancelJob = new cancelJob();
$cancelJob->deleteJob = true;
$cancelJob->sessionId = $sessionId;
$cancelJob->jobId = $myJobId;
$assetService->cancelJob($cancelJob);

JAVA

service.cancelJob(sessionId, jobId, true);

C#
service.cancelJob(sessionId, jobId, true);

Use this code or figure out your own method of cleaning up the completed jobs. Either way, you will save yourself a lot of grief by keeping the list of completed jobs short.