/** * Create and configure a new Experiment * @return Experiment */ public static function assemble_experiment() { $experimentInputs = array(); $scheduling = new ComputationalResourceSchedulingModel(); $scheduling->totalCPUCount = $_POST['cpu-count']; $scheduling->nodeCount = $_POST['node-count']; $scheduling->queueName = $_POST['queue-name']; $scheduling->wallTimeLimit = $_POST['wall-time']; $scheduling->totalPhysicalMemory = $_POST['total-physical-memory']; $scheduling->resourceHostId = $_POST['compute-resource']; $scheduling->staticWorkingDir = $_POST['static-working-dir']; $userConfigData = new UserConfigurationDataModel(); $userConfigData->computationalResourceScheduling = $scheduling; $userConfigData->storageId = Config::get('pga_config.airavata')['gateway-data-store-resource-id']; $userConfigData->airavataAutoSchedule = isset($_POST['enable-auto-scheduling']) ? true : false; if (isset($_POST["userDN"])) { $userConfigData->generateCert = 1; $userConfigData->userDN = $_POST["userDN"]; } $applicationInputs = AppUtilities::get_application_inputs($_POST['application']); $experimentInputs = ExperimentUtilities::process_inputs($applicationInputs, $experimentInputs); if (ExperimentUtilities::$experimentPath == null) { ExperimentUtilities::create_experiment_folder_path(); } $experiment = new ExperimentModel(); // required $experiment->projectId = $_POST['project']; $experiment->userName = Session::get('username'); $experiment->name = $_POST['experiment-name']; $experiment->gatewayId = Config::get('pga_config.airavata')['gateway-id']; $experiment->experimentName = $_POST['experiment-name']; // optional $experiment->description = $_POST['experiment-description']; $experiment->executionId = $_POST['application']; $experiment->userConfigurationData = $userConfigData; $experiment->experimentInputs = $experimentInputs; if (isset($_POST["enableEmailNotification"])) { $experiment->enableEmailNotification = intval($_POST["enableEmailNotification"]); $experiment->emailAddresses = array_unique(array_filter($_POST["emailAddresses"], "trim")); } // adding default experiment outputs for now till prepoulated experiment template is not implemented. $experiment->experimentOutputs = AppUtilities::get_application_outputs($_POST["application"]); if ($experimentInputs) { return $experiment; } }
/** * Create and configure a new Experiment * @return Experiment */ public static function assemble_experiment() { $experimentInputs = array(); $scheduling = new ComputationalResourceSchedulingModel(); $scheduling->totalCPUCount = $_POST['cpu-count']; $scheduling->nodeCount = $_POST['node-count']; $scheduling->queueName = $_POST['queue-name']; $scheduling->wallTimeLimit = $_POST['wall-time']; $scheduling->totalPhysicalMemory = $_POST['total-physical-memory']; $scheduling->resourceHostId = $_POST['compute-resource']; $scheduling->staticWorkingDir = $_POST['static-working-dir']; $userConfigData = new UserConfigurationDataModel(); $userConfigData->computationalResourceScheduling = $scheduling; if (isset($_POST["userDN"])) { $userConfigData->generateCert = 1; $userConfigData->userDN = $_POST["userDN"]; } $applicationInputs = AppUtilities::get_application_inputs($_POST['application']); $experimentInputs = ExperimentUtilities::process_inputs($applicationInputs, $experimentInputs); if (ExperimentUtilities::$experimentPath == null) { ExperimentUtilities::create_experiment_folder_path(); } // $advHandling = new AdvancedOutputDataHandling(); $hostName = $_SERVER['SERVER_NAME']; $expPathConstant = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-absolute-path']; // $advHandling->outputDataDir = str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'], // $expPathConstant, ExperimentUtilities::$experimentPath); // $userConfigData->advanceOutputDataHandling = $advHandling; //TODO: replace constructor with a call to airvata to get a prepopulated experiment template $experiment = new ExperimentModel(); // required $experiment->projectId = $_POST['project']; $experiment->userName = Session::get('username'); $experiment->name = $_POST['experiment-name']; $experiment->gatewayId = "default"; $experiment->experimentName = $_POST['experiment-name']; // optional $experiment->description = $_POST['experiment-description']; $experiment->executionId = $_POST['application']; $experiment->userConfigurationData = $userConfigData; $experiment->experimentInputs = $experimentInputs; if (isset($_POST["enableEmailNotification"])) { $experiment->enableEmailNotification = intval($_POST["enableEmailNotification"]); $experiment->emailAddresses = array_unique(array_filter($_POST["emailAddresses"], "trim")); } // adding default experiment outputs for now till prepoulated experiment template is not implemented. $experiment->experimentOutputs = AppUtilities::get_application_outputs($_POST["application"]); if ($experimentInputs) { return $experiment; } }