function apply_changes_to_experiment($experiment) { $experiment->name = $_POST['experiment-name']; $experiment->description = rtrim($_POST['experiment-description']); $experiment->projectID = $_POST['project']; //$experiment->applicationId = $_POST['application']; $userConfigDataUpdated = $experiment->userConfigurationData; $schedulingUpdated = $userConfigDataUpdated->computationalResourceScheduling; $schedulingUpdated->resourceHostId = $_POST['compute-resource']; $schedulingUpdated->nodeCount = $_POST['node-count']; $schedulingUpdated->totalCPUCount = $_POST['cpu-count']; //$schedulingUpdated->numberOfThreads = $_POST['threads']; $schedulingUpdated->wallTimeLimit = $_POST['wall-time']; //$schedulingUpdated->totalPhysicalMemory = $_POST['memory']; /* switch ($_POST['compute-resource']) { case 'trestles.sdsc.edu': $schedulingUpdated->ComputationalProjectAccount = 'sds128'; break; case 'stampede.tacc.xsede.org': case 'lonestar.tacc.utexas.edu': $schedulingUpdated->ComputationalProjectAccount = 'TG-STA110014S'; break; default: $schedulingUpdated->ComputationalProjectAccount = 'admin'; } */ $userConfigDataUpdated->computationalResourceScheduling = $schedulingUpdated; $experiment->userConfigurationData = $userConfigDataUpdated; $applicationInputs = get_application_inputs($experiment->applicationId); $experimentInputs = $experiment->experimentInputs; // get current inputs //var_dump($experimentInputs); $experimentInputs = process_inputs($applicationInputs, $experimentInputs); // get new inputs //var_dump($experimentInputs); if ($experimentInputs) { $experiment->experimentInputs = $experimentInputs; //var_dump($experiment); return $experiment; } }
/** * Create form inputs to accept the inputs to the given application * @param $id * @param $isRequired * @internal param $required */ function create_inputs($id, $isRequired) { $inputs = get_application_inputs($id); $required = $isRequired ? ' required' : ''; foreach ($inputs as $input) { /* echo '<p>DataType::STRING = ' . \Airavata\Model\AppCatalog\AppInterface\DataType::STRING . '</p>'; echo '<p>DataType::INTEGER = ' . \Airavata\Model\AppCatalog\AppInterface\DataType::INTEGER . '</p>'; echo '<p>DataType::FLOAT = ' . \Airavata\Model\AppCatalog\AppInterface\DataType::FLOAT . '</p>'; echo '<p>DataType::URI = ' . \Airavata\Model\AppCatalog\AppInterface\DataType::URI . '</p>'; echo '<p>$input->type = ' . $input->type . '</p>'; */ switch ($input->type) { case DataType::STRING: echo '<div class="form-group"> <label for="experiment-input">' . $input->name . '</label> <input type="text" class="form-control" name="' . $input->name . '" id="' . $input->name . '" placeholder="' . $input->userFriendlyDescription . '"' . $required . '> </div>'; break; case DataType::INTEGER: case DataType::FLOAT: echo '<div class="form-group"> <label for="experiment-input">' . $input->name . '</label> <input type="number" class="form-control" name="' . $input->name . '" id="' . $input->name . '" placeholder="' . $input->userFriendlyDescription . '"' . $required . '> </div>'; break; case DataType::URI: echo '<div class="form-group"> <label for="experiment-input">' . $input->name . '</label> <input type="file" class="" name="' . $input->name . '" id="' . $input->name . '" ' . $required . '> <p class="help-block">' . $input->userFriendlyDescription . '</p> </div>'; break; default: print_error_message('Input data type not supported! Please file a bug report using the link in the Help menu.'); break; } } }