示例#1
0
/**
 * Kill a job on the corresponding renderer
 *
 * @param string $uid The job id
 * @return boolean Whether the job has been successfully killed
 */
function scheduler_job_kill($uid)
{
    $job = lib_scheduling_job_find(scheduler_processing_get(), $uid);
    $renderer = lib_scheduling_renderer_find(lib_scheduling_renderer_list(), $job['renderer']);
    $status = lib_scheduling_renderer_job_kill($renderer, $job);
    if ($status) {
        lib_scheduling_notice('Scheduler::renderer_job_kill[success]{' . $job['uid'] . '(' . $job['album'] . ' - ' . $job['asset'] . ') on ' . $renderer['host'] . '}');
    } else {
        lib_scheduling_alert('Scheduler::renderer_job_kill[fail]{' . $job['uid'] . '(' . $job['album'] . ' - ' . $job['asset'] . ') on ' . $renderer['host'] . '}');
    }
    return $status;
}
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
/**
 * @package ezcast.ezmanager.cli
 */
include_once 'config.inc';
include_once 'lib_scheduling.php';
include_once 'lib_ezmam.php';
ezmam_repository_path($repository_path);
$uid = $argv[1];
$job = lib_scheduling_job_find(scheduler_processing_get(), $uid);
$renderer = lib_scheduling_renderer_find(lib_scheduling_renderer_list(), $job['renderer']);
$album = $job['album'];
$asset = $job['asset'];
$asset_meta = ezmam_asset_metadata_get($album, $asset);
$job_dir = basename($job['location']);
// Send the video to the renderer download dir
$cmd = $rsync_pgm . ' -L -r -e ssh -tv  --partial-dir=' . $renderer['downloading_dir'] . ' ' . $job['location'] . ' ' . $renderer['client'] . '@' . $renderer['host'] . ':' . $renderer['downloaded_dir'] . ' 2>&1';
// try 3 times
for ($i = 0; $i < 3; $i++) {
    exec($cmd, $out, $err);
    if ($err) {
        lib_scheduling_warning('Scheduler::job_perform[wait]{rsync: ' . $cmd . '}(' . $err . ') |::>' . implode("\n", $out) . ' <::|');
        sleep(600);
    } else {
        break;
    }