echo '<th>Application</th>'; echo '<th>Compute Resource</th>'; echo '<th>Last Modified Time</th>'; echo '<th>Experiment Status</th>'; echo '<th>Job Status</th>'; echo '</tr>'; foreach ($experiments as $experiment) { $expValues = ExperimentUtilities::get_experiment_values($experiment, ProjectUtilities::get_project($experiment->projectId), true); $expValues["jobState"] = ExperimentUtilities::get_job_status($experiment); $applicationInterface = AppUtilities::get_application_interface($experiment->executionId); echo '<tr>'; echo '<td>' . $experiment->experimentName . '</td>'; echo "<td>{$applicationInterface->applicationName}</td>"; echo '<td>'; try { $cr = CRUtilities::get_compute_resource($experiment->userConfigurationData->computationalResourceScheduling->resourceHostId); if (!empty($cr)) { echo $cr->hostName; } } catch (Exception $ex) { //Error while retrieving the CR } echo '</td>'; echo '<td class="time" unix-time="' . $expValues["experimentTimeOfStateChange"] . '"></td>'; echo '<td>'; switch ($expValues["experimentStatusString"]) { case 'CANCELING': case 'CANCELED': case 'UNKNOWN': $textClass = 'text-warning'; break;
public static function create_or_update_DMIObject($inputs, $update = false) { $computeResource = CRUtilities::get_compute_resource($inputs["crId"]); if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) { if (Cache::has('CR-' . $inputs["crId"])) { Cache::forget('CR-' . $inputs["crId"]); } } if ($inputs["dataMovementProtocol"] == DataMovementProtocol::LOCAL) { $localDataMovement = new LOCALDataMovement(); $localdmp = Airavata::addLocalDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $localDataMovement); if ($localdmp) { print_r("The Local Data Movement has been added. Edit UI for the Local Data Movement Interface is yet to be made.\n Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource."); } } else { if ($inputs["dataMovementProtocol"] == DataMovementProtocol::SCP) { //var_dump( $inputs); exit; $scpDataMovement = new SCPDataMovement(array("securityProtocol" => intval($inputs["securityProtocol"]), "alternativeSCPHostName" => $inputs["alternativeSSHHostName"], "sshPort" => intval($inputs["sshPort"]))); if ($update) { $scpdmp = Airavata::updateSCPDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $scpDataMovement); } else { $scpdmp = Airavata::addSCPDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $scpDataMovement); } } else { if ($inputs["dataMovementProtocol"] == DataMovementProtocol::GridFTP) { $gridFTPDataMovement = new GridFTPDataMovement(array("securityProtocol" => $inputs["securityProtocol"], "gridFTPEndPoints" => $inputs["gridFTPEndPoints"])); if ($update) { $gridftpdmp = Airavata::updateGridFTPDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $gridFTPDataMovement); } else { $gridftpdmp = Airavata::addGridFTPDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $gridFTPDataMovement); } } else { if ($inputs["dataMovementProtocol"] == DataMovementProtocol::UNICORE_STORAGE_SERVICE) { $unicoreDataMovement = new UnicoreDataMovement(array("securityProtocol" => intval($inputs["securityProtocol"]), "unicoreEndPointURL" => $inputs["unicoreEndPointURL"])); if ($update) { $unicoredmp = Airavata::updateUnicoreDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $unicoreDataMovement); } else { $unicoredmp = Airavata::addUnicoreDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $unicoreDataMovement); } } else { print_r("Whoops! We haven't coded for this Data Movement Protocol yet. Still working on it. Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource."); } } } } }
public static function get_experiment_values($experiment, $project, $forSearch = false) { $expVal = array(); //$expVal["experimentStatusString"] = ""; $expVal["experimentTimeOfStateChange"] = ""; $expVal["experimentCreationTime"] = ""; $expVal["experimentStates"] = ExperimentState::$__names; $expVal["processStates"] = ProcessState::$__names; $expVal["jobStates"] = JobState::$__names; $expVal["taskStates"] = TaskState::$__names; $expVal["taskTypes"] = TaskTypes::$__names; $experimentStatusString = $expVal["experimentStates"][$experiment->experimentStatus->state]; $expVal["experimentStatusString"] = $experimentStatusString; if ($experimentStatusString == ExperimentState::FAILED) { $expVal["editable"] = false; } $expVal["cancelable"] = false; if ($experimentStatusString == ExperimentState::LAUNCHED || $experimentStatusString == ExperimentState::EXECUTING) { $expVal["cancelable"] = true; } if ($experiment->experimentStatus != null) { $experimentStatus = $experiment->experimentStatus; /* $experimentState = $experimentStatus->state; $experimentStatusString = ExperimentState::$__names[$experimentState]; $expVal["experimentStatusString"] = $experimentStatusString; */ $expVal["experimentTimeOfStateChange"] = $experimentStatus->timeOfStateChange / 1000; // divide by 1000 since timeOfStateChange is in ms $expVal["experimentCreationTime"] = $experiment->creationTime / 1000; // divide by 1000 since creationTime is in ms } if (!$forSearch) { $userConfigData = $experiment->userConfigurationData; $scheduling = $userConfigData->computationalResourceScheduling; $expVal['scheduling'] = $scheduling; try { $expVal["computeResource"] = CRUtilities::get_compute_resource($scheduling->resourceHostId); } catch (Exception $ex) { //Error while retrieving CR $expVal["computeResource"] = ""; } } try { $expVal["applicationInterface"] = AppUtilities::get_application_interface($experiment->executionId); } catch (Exception $ex) { //Failed retrieving Application Interface (May be it's deleted) Fix for Airavata-1801 $expVal["applicationInterface"] = new ApplicationInterfaceDescription(); $expVal["applicationInterface"]->applicationName = substr($experiment->executionId, -8); } switch (ExperimentState::$__names[$experiment->experimentStatus->state]) { case 'CREATED': case 'VALIDATED': case 'SCHEDULED': case 'FAILED': $expVal["editable"] = true; break; default: $expVal["editable"] = false; break; } switch (ExperimentState::$__names[$experiment->experimentStatus->state]) { case 'VALIDATED': case 'SCHEDULED': case 'LAUNCHED': case 'EXECUTING': $expVal["cancelable"] = true; break; default: $expVal["cancelable"] = false; break; } return $expVal; }
public function editSubmit() { $tabName = ""; if (Input::get("cr-edit") == "resDesc") { $computeDescription = CRUtilities::get_compute_resource(Input::get("crId")); $computeDescription->hostName = trim(Input::get("hostname")); $computeDescription->hostAliases = array_unique(array_filter(Input::get("hostaliases"))); $computeDescription->ipAddresses = array_unique(array_filter(Input::get("ips"))); $computeDescription->resourceDescription = Input::get("description"); $computeDescription->maxMemoryPerNode = Input::get("maxMemoryPerNode"); //var_dump( $computeDescription); exit; $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true); $tabName = "#tab-desc"; } if (Input::get("cr-edit") == "queue") { $queue = array("queueName" => Input::get("qname"), "queueDescription" => Input::get("qdesc"), "maxRunTime" => Input::get("qmaxruntime"), "maxNodes" => Input::get("qmaxnodes"), "maxProcessors" => Input::get("qmaxprocessors"), "maxJobsInQueue" => Input::get("qmaxjobsinqueue"), "maxMemory" => Input::get("qmaxmemoryinqueue")); $computeDescription = CRUtilities::get_compute_resource(Input::get("crId")); $computeDescription->batchQueues[] = CRUtilities::createQueueObject($queue); $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true); //var_dump( $computeResource); exit; $tabName = "#tab-queues"; } else { if (Input::get("cr-edit") == "delete-queue") { CRUtilities::deleteQueue(Input::get("crId"), Input::get("queueName")); $tabName = "#tab-queues"; } else { if (Input::get("cr-edit") == "fileSystems") { $computeDescription = CRUtilities::get_compute_resource(Input::get("crId")); $computeDescription->fileSystems = array_filter(Input::get("fileSystems"), "trim"); $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true); $tabName = "#tab-filesystem"; } else { if (Input::get("cr-edit") == "jsp" || Input::get("cr-edit") == "edit-jsp") { $update = false; if (Input::get("cr-edit") == "edit-jsp") { $update = true; } $jobSubmissionInterface = CRUtilities::create_or_update_JSIObject(Input::all(), $update); $tabName = "#tab-jobSubmission"; } else { if (Input::get("cr-edit") == "jsi-priority") { $inputs = Input::all(); $computeDescription = CRUtilities::get_compute_resource(Input::get("crId")); foreach ($computeDescription->jobSubmissionInterfaces as $index => $jsi) { foreach ($inputs["jsi-id"] as $idIndex => $jsiId) { if ($jsiId == $jsi->jobSubmissionInterfaceId) { $computeDescription->jobSubmissionInterfaces[$index]->priorityOrder = $inputs["jsi-priority"][$idIndex]; break; } } } $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true); return 1; //currently done by ajax. } else { if (Input::get("cr-edit") == "dmp" || Input::get("cr-edit") == "edit-dmi") { $update = false; if (Input::get("cr-edit") == "edit-dmi") { $update = true; } $dataMovementInterface = CRUtilities::create_or_update_DMIObject(Input::all(), $update); $tabName = "#tab-dataMovement"; } else { if (Input::get("cr-edit") == "dmi-priority") { $inputs = Input::all(); $computeDescription = CRUtilities::get_compute_resource(Input::get("crId")); foreach ($computeDescription->dataMovementInterfaces as $index => $dmi) { foreach ($inputs["dmi-id"] as $idIndex => $dmiId) { if ($dmiId == $dmi->dataMovementInterfaceId) { $computeDescription->dataMovementInterfaces[$index]->priorityOrder = $inputs["dmi-priority"][$idIndex]; break; } } } $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true); return 1; //currently done by ajax. } } } } } } } return Redirect::to("cr/edit?crId=" . Input::get("crId") . $tabName); }
public function disableComputeResource() { $resourceId = Input::get("resourceId"); $computeResource = CRUtilities::get_compute_resource($resourceId); $computeResource->enabled = false; CRUtilities::register_or_update_compute_resource($computeResource, true); }
public function viewView() { $data = CRUtilities::getEditCRData(); $computeResourceId = ""; if (Input::has("crId")) { $computeResourceId = Input::get("crId"); } else { if (Session::has("computeResource")) { $computeResource = Session::get("computeResource"); $computeResourceId = $computeResource->computeResourceId; } } if ($computeResourceId != "") { $computeResource = CRUtilities::get_compute_resource($computeResourceId); $jobSubmissionInterfaces = array(); $dataMovementInterfaces = array(); $addedJSP = array(); $addedDMI = array(); //var_dump( $computeResource->jobSubmissionInterfaces); exit; if (count($computeResource->jobSubmissionInterfaces)) { foreach ($computeResource->jobSubmissionInterfaces as $JSI) { $jobSubmissionInterfaces[] = CRUtilities::getJobSubmissionDetails($JSI->jobSubmissionInterfaceId, $JSI->jobSubmissionProtocol); $addedJSP[] = $JSI->jobSubmissionProtocol; } } //var_dump( CRUtilities::getJobSubmissionDetails( $data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 1) ); exit; if (count($computeResource->dataMovementInterfaces)) { foreach ($computeResource->dataMovementInterfaces as $DMI) { $dataMovementInterfaces[] = CRUtilities::getDataMovementDetails($DMI->dataMovementInterfaceId, $DMI->dataMovementProtocol); $addedDMI[] = $DMI->dataMovementProtocol; } } $data["computeResource"] = $computeResource; $data["jobSubmissionInterfaces"] = $jobSubmissionInterfaces; $data["dataMovementInterfaces"] = $dataMovementInterfaces; $data["addedJSP"] = $addedJSP; $data["addedDMI"] = $addedDMI; //var_dump($data["jobSubmissionInterfaces"]); exit; return View::make("resource/view", $data); } else { return View::make("resource/browse")->with("login-alert", "Unable to retrieve this Compute Resource. Please report this error to devs."); } }
public static function get_experiment_values($experiment, $project, $forSearch = false) { //var_dump( $experiment); exit; $expVal = array(); $expVal["experimentStatusString"] = ""; $expVal["experimentTimeOfStateChange"] = ""; $expVal["experimentCreationTime"] = ""; if ($experiment->experimentStatus != null) { $experimentStatus = $experiment->experimentStatus; $experimentState = $experimentStatus->state; $experimentStatusString = ExperimentState::$__names[$experimentState]; $expVal["experimentStatusString"] = $experimentStatusString; $expVal["experimentTimeOfStateChange"] = $experimentStatus->timeOfStateChange / 1000; // divide by 1000 since timeOfStateChange is in ms $expVal["experimentCreationTime"] = $experiment->creationTime / 1000; // divide by 1000 since creationTime is in ms } if (!$forSearch) { $userConfigData = $experiment->userConfigurationData; $scheduling = $userConfigData->computationalResourceScheduling; $expVal['scheduling'] = $scheduling; try { $expVal["computeResource"] = CRUtilities::get_compute_resource($scheduling->resourceHostId); } catch (Exception $ex) { //Error while retrieving CR $expVal["computeResource"] = ""; } } $expVal["applicationInterface"] = AppUtilities::get_application_interface($experiment->executionId); switch ($experimentStatusString) { case 'CREATED': case 'VALIDATED': case 'SCHEDULED': case 'FAILED': $expVal["editable"] = true; break; default: $expVal["editable"] = false; break; } switch ($experimentStatusString) { case 'CREATED': case 'VALIDATED': case 'SCHEDULED': case 'LAUNCHED': case 'EXECUTING': $expVal["cancelable"] = true; break; default: $expVal["cancelable"] = false; break; } return $expVal; }