/** * Method to get experiments of a particular time range * @param $inputs * @return array */ public static function get_experiments_of_time_range($inputs) { $experimentStatistics = AdminUtilities::get_experiment_execution_statistics(strtotime($inputs["from-date"]) * 1000, strtotime($inputs["to-date"]) * 1000); $experiments = array(); if ($inputs["status-type"] == "ALL") { $experiments = $experimentStatistics->allExperiments; } else { if ($inputs["status-type"] == "COMPLETED") { $experiments = $experimentStatistics->completedExperiments; } elseif ($inputs["status-type"] == "FAILED") { $experiments = $experimentStatistics->failedExperiments; } else { if ($inputs["status-type"] == "CANCELED") { $experiments = $experimentStatistics->cancelledExperiments; } } } $expContainer = array(); $expNum = 0; foreach ($experiments as $experiment) { $expValue = ExperimentUtilities::get_experiment_values($experiment, ProjectUtilities::get_project($experiment->projectID), true); $expContainer[$expNum]['experiment'] = $experiment; $expValue["editable"] = false; $expContainer[$expNum]['expValue'] = $expValue; $expNum++; } return $expContainer; }
/** * Create a select input and populate it with project options from the database */ public static function create_project_select($projectId = null, $editable = true) { $editable ? $disabled = '' : ($disabled = 'disabled'); $userProjects = ProjectUtilities::get_all_user_projects(Session::get("gateway_id"), Session::get('username')); echo '<select class="form-control" name="project" id="project" required ' . $disabled . '>'; if (sizeof($userProjects) > 0) { foreach ($userProjects as $project) { if ($project->projectID == $projectId) { $selected = 'selected'; } else { $selected = ''; } echo '<option value="' . $project->projectID . '" ' . $selected . '>' . $project->name . '</option>'; } } echo '</select>'; }
/** * Create a select input and populate it with project options from the database */ public static function create_project_select($projectId = null, $editable = true) { $editable ? $disabled = '' : ($disabled = 'disabled'); $userProjects = ProjectUtilities::get_all_user_projects(Session::get("gateway_id"), Session::get('username')); echo '<select class="form-control" name="project" id="project" required ' . $disabled . '>'; if (sizeof($userProjects) > 0) { foreach ($userProjects as $project) { if ($project->projectID == $projectId) { $selected = 'selected'; } else { $selected = ''; } echo '<option value="' . $project->projectID . '" ' . $selected . '>' . $project->name . '</option>'; } } echo '</select>'; if (sizeof($userProjects) == 0) { CommonUtilities::print_warning_message('<p>You must create a project before you can create an experiment. Click <a href="' . URL::to('/') . '/project/create">here</a> to create a project.</p>'); } }
public function createAccountSubmit() { $rules = array("username" => "required|min:6", "password" => "required|min:6", "confirm_password" => "required|same:password", "email" => "required|email"); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { $messages = $validator->messages(); return Redirect::to("create")->withInput(Input::except('password', 'password_confirm'))->withErrors($validator); } $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $username = $_POST['username']; $password = $_POST['password']; $email = $_POST['email']; //Fixme - Save these user information // $organization = $_POST['organization']; // $address = $_POST['address']; // $country = $_POST['country']; // $telephone = $_POST['telephone']; // $mobile = $_POST['mobile']; // $im = $_POST['im']; // $url = $_POST['url']; $organization = ""; $address = ""; $country = ""; $telephone = ""; $mobile = ""; $im = ""; $url = ""; if (WSIS::usernameExists($username)) { return Redirect::to("create")->withInput(Input::except('password', 'password_confirm'))->with("username_exists", true); } else { WSIS::addUser($username, $password, $first_name, $last_name, $email, $organization, $address, $country, $telephone, $mobile, $im, $url); //update user profile WSIS::updateUserProfile($username, $email, $first_name, $last_name); //creating a default project for user ProjectUtilities::create_default_project($username); CommonUtilities::print_success_message('New user created!'); return View::make('account/login'); } }
public function browseView() { $pageNo = Input::get('pageNo'); $prev = Input::get('prev'); $isSearch = Input::get('search'); if (empty($pageNo) || isset($isSearch)) { $pageNo = 1; } else { if (isset($prev)) { $pageNo -= 1; } else { $pageNo += 1; } } $searchValue = Input::get("search-value"); if (!empty($searchValue)) { $projects = ProjectUtilities::get_projsearch_results_with_pagination(Input::get("search-key"), Input::get("search-value"), $this->limit, ($pageNo - 1) * $this->limit); } else { $projects = ProjectUtilities::get_all_user_projects_with_pagination($this->limit, ($pageNo - 1) * $this->limit); } return View::make('project/browse', array('pageNo' => $pageNo, 'limit' => $this->limit, 'projects' => $projects)); }
echo '<h3>' . $project->name . ' <a href="edit?projId=' . $project->projectID . '" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a></h3>'; echo "<p>{$project->description}</p>"; echo '</div>'; $experiments = ProjectUtilities::get_experiments_in_project($project->projectID); echo '<div class="table-responsive">'; echo '<table class="table">'; echo '<tr>'; echo '<th>Name</th>'; 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>';
/** * Get results of the user's search of experiments * @return array|null */ public static function get_expsearch_results($inputs) { $experiments = array(); try { switch ($inputs["search-key"]) { case 'experiment-name': $experiments = Airavata::searchExperimentsByName(Session::get('authz-token'), Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]); break; case 'experiment-description': $experiments = Airavata::searchExperimentsByDesc(Session::get('authz-token'), Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]); break; case 'application': $experiments = Airavata::searchExperimentsByApplication(Session::get('authz-token'), Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]); break; case 'creation-time': $experiments = Airavata::searchExperimentsByCreationTime(Session::get('authz-token'), Session::get('gateway_id'), Session::get('username'), strtotime($inputs["from-date"]) * 1000, strtotime($inputs["to-date"]) * 1000); break; case '': } } catch (InvalidRequestException $ire) { CommonUtilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage()); } catch (AiravataClientException $ace) { CommonUtilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage()); } catch (AiravataSystemException $ase) { if ($ase->airavataErrorType == 2) { CommonUtilities::print_info_message('<p>You have not created any experiments yet, so no results will be returned!</p> <p>Click <a href="create_experiment.php">here</a> to create an experiment, or <a href="create_project.php">here</a> to create a new project.</p>'); } else { CommonUtilities::print_error_message('There was a problem with Airavata. Please try again later or report a bug using the link in the Help menu.'); //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage()); } } catch (TTransportException $tte) { CommonUtilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage()); } //get values of all experiments $expContainer = array(); $expNum = 0; foreach ($experiments as $experiment) { $expValue = ExperimentUtilities::get_experiment_search_values($experiment, ProjectUtilities::get_project($experiment->projectId), true); $expContainer[$expNum]['experiment'] = $experiment; if ($expValue["experimentStatusString"] == "FAILED") { $expValue["editable"] = false; } $expContainer[$expNum]['expValue'] = $expValue; $expNum++; } return $expContainer; }
public function cloneExperiment() { if (isset($_GET['expId'])) { $cloneId = ExperimentUtilities::clone_experiment($_GET['expId']); $experiment = ExperimentUtilities::get_experiment($cloneId); $project = ProjectUtilities::get_project($experiment->projectId); $expVal = ExperimentUtilities::get_experiment_values($experiment, $project); $expVal["jobState"] = ExperimentUtilities::get_job_status($experiment); return Redirect::to('experiment/edit?expId=' . $cloneId); } }
/** * Get results of the user's all experiments with pagination. * Results are ordered creation time DESC * @return array|null */ public static function get_all_user_experiments_with_pagination($limit, $offset) { $experiments = array(); try { $experiments = Airavata::getAllUserExperimentsWithPagination( Session::get('gateway_id'), Session::get('username'), $limit, $offset ); } catch (InvalidRequestException $ire) { CommonUtilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage()); } catch (AiravataClientException $ace) { CommonUtilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage()); } catch (AiravataSystemException $ase) { if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR { CommonUtilities::print_info_message('<p>You have not created any experiments yet, so no results will be returned!</p> <p>Click <a href="create_experiment.php">here</a> to create an experiment, or <a href="create_project.php">here</a> to create a new project.</p>'); } else { CommonUtilities::print_error_message('There was a problem with Airavata. Please try again later or report a bug using the link in the Help menu.'); //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage()); } } catch (TTransportException $tte) { CommonUtilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage()); } //get values of all experiments $expContainer = array(); $expNum = 0; foreach ($experiments as $experiment) { $expValue = ExperimentUtilities::get_experiment_values($experiment, ProjectUtilities::get_project($experiment->projectId), true); $expContainer[$expNum]['experiment'] = $experiment; if ($expValue["experimentStatusString"] == "FAILED") $expValue["editable"] = false; $expContainer[$expNum]['expValue'] = $expValue; $expNum++; } return $expContainer; }
<?php $project = ProjectUtilities::get_project($_GET['projId']); ?> <h1>Project Summary @if( !isset($dashboard)) <small><a href="{{ URL::to('/') }}/project/summary?projId={{ $project->projectID }}" title="Refresh"><span class="glyphicon glyphicon-refresh refresh-exp"></span></a></small> @endif </h1> <?php echo '<div>'; echo '<div>'; echo '<h3>' . $project->name . ' <a href="edit?projId=' . $project->projectID . '" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a></h3>'; echo "<p>{$project->description}</p>"; echo '</div>'; $experiments = ProjectUtilities::get_experiments_in_project($project->projectID); echo '<div class="table-responsive">'; echo '<table class="table">'; echo '<tr>'; echo '<th>Name</th>'; 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, $project, true); $expValues["jobState"] = ExperimentUtilities::get_job_status($experiment); $applicationInterface = AppUtilities::get_application_interface($experiment->executionId); switch ($expValues["experimentStatusString"]) {
private function initializeWithAiravata($username) { //Check Airavata Server is up try { //creating a default project for user $projects = ProjectUtilities::get_all_user_projects(Config::get('pga_config.airavata')['gateway-id'], $username); if ($projects == null || count($projects) == 0) { //creating a default project for user ProjectUtilities::create_default_project($username); } } catch (Exception $ex) { CommonUtilities::print_error_message("Unable to Connect to the Airavata Server Instance!"); return View::make('home'); } return Redirect::to("admin/dashboard"); }
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->applicationId, $expVal['scheduling']->resourceHostId); $experimentInputs = array("disabled" => ' ', "experimentName" => $experiment->name, "experimentDescription" => $experiment->description, "application" => $experiment->applicationId, "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)); }