public static function processTaskQueue() { set_time_limit(0); ignore_user_abort(1); $db = BFL_Database::getInstance(); $lock_tables = array(DB_TABLE_JUDGER . ' write', DB_TABLE_RECORD . ' write', DB_TABLE_RECORDMETA . ' write', DB_TABLE_PROB . ' read'); $db->lock($lock_tables, true); //Get Available Judger $judger = MDL_Judger_Set::getAvailableJudger(); if ($judger == NULL) { $db->unlock(); return 'nojudger'; } $judger_id = $judger->getID(); $task = self::getTask(); if (!$task) { $db->unlock(); return 'notask'; } //Pend task MDL_Judge_Record::pend($task['record_id'], $judger_id); //lock judger $judger->lock(); $db->unlock(); //upload source $task['src_name'] = self::getSrcname($task['task_name'], $task['language']); MDL_Judger_Transmit::sendTask($judger, $task['task_name'], $task['source'], $task['src_name']); //send judge request $config = MDL_Config::getInstance(); MDL_Judger_Access::sendRequest($judger, $task); }
public static function transmitTestdata($judger_id, $data_config) { $judger = new MDL_Judger($judger_id); //Upload testdata files MDL_Judger_Transmit::sendTestdata($judger, $data_config); $judger_url = $judger->getConfig()->getRemoteURL(); $public_key = $judger->getConfig()->getRemoteKey(); return MDL_Judger_Data::updateTestdata($judger_url, $public_key, $data_config['name']); }