global $db; $stmt = $db->prepare(self::SQL_FETCH_EVALUATION); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $value) { $st0 = $db->prepare(self::SQL_SET_TEMP_INFO); $st0->bindValue(':id', $value['id'], PDO::PARAM_STR); $st0->execute(); $st = $db->prepare(self::SQL_GET_INFO); $st->bindValue(':evaluation_id', $value['id'], PDO::PARAM_STR); $st->execute(); $row = $st->fetch(PDO::FETCH_ASSOC); $model_body = $row['mbody']; $index_path = $row['path']; $query_path = $row['query_path']; $judgement_path = $row['evaluation_path']; $status_code; $status_msg; $performances_str; $this->evaluate_using_docker($model_body, $index_path, $query_path, $judgement_path, $status_code, $status_msg, $performances_str); //var_dump($status_code); //var_dump($status_msg); $this->update_evaluation_status($status_code, $status_msg, $performances_str, $value['id']); } } catch (PDOException $Exception) { throw new RuleException($Exception->getMessage(), 401); } } } $deamon = new Deamon(); $deamon->evaluate_model();
try { global $db; $stmt = $db->prepare(self::SQL_UPDATE_COMPILE_MODEL); $stmt->execute(array(':last_compile_dt' => gmdate('Y-m-d H:i:s'), ':compile_status' => $compile_status, ':compile_msg' => $compile_status === 0 ? "" : $compile_msg, ':mid' => $mid)); } catch (PDOException $Exception) { throw new RuleException($Exception->getMessage(), 401); } } public function compile_model() { //$this->validate_admin($uid, $apikey); try { global $db; $stmt = $db->prepare(self::SQL_FETCH_ONE_MODEL); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $value) { $status_code; $status_msg; $this->compile_using_docker($value['mbody'], $status_code, $status_msg); //var_dump($status_code); //var_dump($status_msg); $this->update_model_compile_db($status_code, $status_msg, $value['mid']); } } catch (PDOException $Exception) { throw new RuleException($Exception->getMessage(), 401); } } } $deamon = new Deamon(); $deamon->compile_model();