/**
  * batch getExclusiveAlmostDone action allows to get a BatchJob that wait for remote closure 
  * 
  * @action getExclusiveAlmostDone
  * @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism  
  * @param int $maxExecutionTime The maximum time in seconds the job reguarly take. Is used for the locking mechanism when determining an unexpected termination of a batch-process.
  * @param int $numberOfJobs The maximum number of jobs to return. 
  * @param KalturaBatchJobFilter $filter Set of rules to fetch only rartial list of jobs  
  * @param KalturaBatchJobType $jobType The type of the job - could be a custom extended type
  * @return KalturaBatchJobArray 
  */
 function getExclusiveAlmostDoneAction(KalturaExclusiveLockKey $lockKey, $maxExecutionTime, $numberOfJobs, KalturaBatchJobFilter $filter = null, $jobType = null)
 {
     $jobType = kPluginableEnumsManager::apiToCore('BatchJobType', $jobType);
     $jobsFilter = new BatchJobFilter();
     if ($filter) {
         $jobsFilter = $filter->toFilter($jobType);
     }
     $jobs = kBatchManager::getExclusiveAlmostDoneJobs($lockKey->toObject(), $maxExecutionTime, $numberOfJobs, $jobType, $jobsFilter);
     return KalturaBatchJobArray::fromBatchJobArray($jobs);
 }