public function delete() { //var_dump( Input::all()); exit; $error = false; if (Input::has("del-gpId")) { if (CRUtilities::deleteGP(Input::get("del-gpId"))) { return Redirect::to("admin/dashboard/gateway")->with("message", "Gateway Profile has been deleted."); } else { $error = true; } } else { if (Input::has("rem-crId")) { if (CRUtilities::deleteCR(Input::all())) { return Redirect::to("admin/dashboard/gateway")->with("message", "The selected Compute Resource has been successfully removed"); } else { $error = true; } } else { $error = true; } } if ($error) { return Redirect::to("admin/dashboard/gateway")->with("message", "An error has occurred. Please try again later or report a bug using the link in the Help menu"); } }
public function cstChange() { $inputs = Input::all(); if (CRUtilities::updateGatewayProfile($inputs)) { return "Credential Store Token has been updated"; } else { return "An error has occurred. Please try again later or report a bug using the link in the Help menu"; } }
public static function getBrowseCRData(){ $appDeployments = Airavata::getAllApplicationDeployments( Session::get("gateway_id")); return array( 'crObjects' => CRUtilities::getAllCRObjects(true), 'appDeployments' => $appDeployments ); }
/** * Create a select input and populate it with compute resources * available for the given application ID * @param $applicationId * @param $resourceHostId */ public static function create_compute_resources_select($applicationId, $resourceHostId) { return CRUtilities::get_available_app_interface_compute_resources($applicationId); }
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 function browseView() { $data = CRUtilities::getBrowseCRData(); $allCRs = $data["crObjects"]; $appDeployments = $data["appDeployments"]; $connectedDeployments = array(); foreach ((array) $allCRs as $crId => $crName) { $connectedDeployments[$crId] = 0; foreach ((array) $appDeployments as $deploymentObject) { if ($crId == $deploymentObject->computeHostId) { $connectedDeployments[$crId]++; } } } return View::make("resource/browse", array("allCRs" => $allCRs, "connectedDeployments" => $connectedDeployments)); }
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 disableComputeResource() { $resourceId = Input::get("resourceId"); $computeResource = CRUtilities::get_compute_resource($resourceId); $computeResource->enabled = false; CRUtilities::register_or_update_compute_resource($computeResource, true); }
public function editView() { $queueDefaults = array("queueName" => Config::get('pga_config.airavata')["queue-name"], "nodeCount" => Config::get('pga_config.airavata')["node-count"], "cpuCount" => Config::get('pga_config.airavata')["total-cpu-count"], "wallTimeLimit" => Config::get('pga_config.airavata')["wall-time-limit"]); $experiment = ExperimentUtilities::get_experiment($_GET['expId']); $project = ProjectUtilities::get_project($experiment->projectId); $expVal = ExperimentUtilities::get_experiment_values($experiment, $project); $expVal["jobState"] = ExperimentUtilities::get_job_status($experiment); $computeResources = CRUtilities::create_compute_resources_select($experiment->executionId, $expVal['scheduling']->resourceHostId); $experimentInputs = array("disabled" => ' ', "experimentName" => $experiment->experimentName, "experimentDescription" => $experiment->description, "application" => $experiment->executionId, "allowedFileSize" => Config::get('pga_config.airavata')["server-allowed-file-size"], 'experiment' => $experiment, "queueDefaults" => $queueDefaults, 'project' => $project, 'expVal' => $expVal, 'cloning' => true, 'advancedOptions' => Config::get('pga_config.airavata')["advanced-experiment-options"], 'computeResources' => $computeResources, "resourceHostId" => $expVal['scheduling']->resourceHostId, 'project' => $project, 'expVal' => $expVal, 'cloning' => true, 'advancedOptions' => Config::get('pga_config.airavata')["advanced-experiment-options"]); return View::make("experiment/edit", array("expInputs" => $experimentInputs)); }
public function resourcesView() { $data = CRUtilities::getBrowseCRData(); $allCRs = $data["crObjects"]; return View::make("admin/manage-resources", array("resources" => $allCRs)); }
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; }
public function browseView() { $data = CRUtilities::getBrowseCRData(false); $allCRs = $data["crObjects"]; $appDeployments = $data["appDeployments"]; $connectedDeployments = array(); foreach ((array) $allCRs as $resource) { $crId = $resource->computeResourceId; $connectedDeployments[$crId] = 0; foreach ((array) $appDeployments as $deploymentObject) { if ($crId == $deploymentObject->computeHostId) { $connectedDeployments[$crId]++; } } } Session::put("admin-nav", "cr-browse"); return View::make("resource/browse", array("allCRs" => $allCRs, "connectedDeployments" => $connectedDeployments)); }