public static function ConfigJob($filename) { //number of processes that are available $numCpus = Pain::GetProcesses(); //check number of meshes $numMeshes = pc::CountMeshes($filename); if ($numMeshes != 0) { if ($numMeshes < $numCpus) { $numCpus = $numMeshes; } } else { $numCpus = 1; } return $numCpus; }
public static function CountMeshes($filename) { $meshCount = 0; $result = file_exists("uploads/" . $filename); if (file_exists("uploads/" . $filename)) { $file = pc::createTempFile("uploads/" . $filename); $lineCount = count($file); for ($i = 0; $i < $lineCount; $i++) { if (strpos($file[$i], "MESH") != false) { $meshCount++; } } } return $meshCount; }
public static function refreshJobs() { $jobs = R::find('job'); if (!count($jobs)) { return array(false); } $beans = R::exportAll($jobs); foreach ($beans as $bean) { $percentage = pc::getTime($bean["timestamp"] . '/' . substr($bean["name"], 0, strrpos($bean["name"], '.')) . ".out", $bean["id"]); if ($percentage != null) { DB::UpdateStatus($bean["id"], round($percentage, 2)); } else { DB::UpdateStatus($bean["id"], 0); } } return array(true, $beans); }