本文整理汇总了PHP中Utilities::get_compute_resource方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::get_compute_resource方法的具体用法?PHP Utilities::get_compute_resource怎么用?PHP Utilities::get_compute_resource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utilities
的用法示例。
在下文中一共展示了Utilities::get_compute_resource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editSubmit
public function editSubmit()
{
$tabName = "";
if (Input::get("cr-edit") == "resDesc") {
$computeDescription = Utilities::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 = Utilities::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 = Utilities::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 = Utilities::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 = Utilities::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);
}
示例2: create_or_update_DMIObject
public static function create_or_update_DMIObject( $inputs, $update = false){
$computeResource = Utilities::get_compute_resource( $inputs["crId"] );
if( $inputs["dataMovementProtocol"] == DataMovementProtocol::LOCAL) /* LOCAL */
{
$localDataMovement = new LOCALDataMovement();
$localdmp = Airavata::addLocalDataMovementDetails( $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.
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) /* 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( $inputs["dmiId"], $scpDataMovement);
else
$scpdmp = Airavata::addSCPDataMovementDetails( $computeResource->computeResourceId, 0, $scpDataMovement);
}
else if( $inputs["dataMovementProtocol"] == DataMovementProtocol::GridFTP) /* GridFTP */
{
$gridFTPDataMovement = new GridFTPDataMovement( array(
"securityProtocol" => $inputs["securityProtocol"],
"gridFTPEndPoints" => $inputs["gridFTPEndPoints"]
));
if( $update)
$gridftpdmp = Airavata::updateGridFTPDataMovementDetails( $inputs["dmiId"], $gridFTPDataMovement);
else
$gridftpdmp = Airavata::addGridFTPDataMovementDetails( $computeResource->computeResourceId, 0, $gridFTPDataMovement);
}
else if( $inputs["dataMovementProtocol"] == DataMovementProtocol::UNICORE_STORAGE_SERVICE) /* Unicore Storage Service */
{
$unicoreDataMovement = new UnicoreDataMovement( array
(
"securityProtocol" => intval( $inputs["securityProtocol"]),
"unicoreEndPointURL" => $inputs["unicoreEndPointURL"]
)
);
if( $update)
$unicoredmp = Airavata::updateUnicoreDataMovementDetails( $inputs["dmiId"], $unicoreDataMovement);
else
$unicoredmp = Airavata::addUnicoreDataMovementDetails( $computeResource->computeResourceId, 0, $unicoreDataMovement);
}
else /* other data movement protocols */
{
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.");
}
}
示例3: get_experiment_values
public static function get_experiment_values( $experiment, $project, $forSearch = false)
{
$expVal = array();
$expVal["experimentStatusString"] = "";
$expVal["experimentTimeOfStateChange"] = "";
$expVal["experimentCreationTime"] = "";
if( $experiment->experimentStatus != null)
{
$experimentStatus = $experiment->experimentStatus;
$experimentState = $experimentStatus->experimentState;
$experimentStatusString = ExperimentState::$__names[$experimentState];
$expVal["experimentStatusString"] = $experimentStatusString;
$expVal["experimentTimeOfStateChange"] = date('Y-m-d H:i:s', $experimentStatus->timeOfStateChange/1000); // divide by 1000 since timeOfStateChange is in ms
$expVal["experimentCreationTime"] = date('Y-m-d H:i:s', $experiment->creationTime/1000); // divide by 1000 since creationTime is in ms
}
$jobStatus = Airavata::getJobStatuses($experiment->experimentID);
if ($jobStatus)
{
$jobName = array_keys($jobStatus);
$jobState = JobState::$__names[$jobStatus[$jobName[0]]->jobState];
}
else
{
$jobState = null;
}
$expVal["jobState"] = $jobState;
if(! $forSearch)
{
$userConfigData = $experiment->userConfigurationData;
$scheduling = $userConfigData->computationalResourceScheduling;
$expVal['scheduling'] = $scheduling;
$expVal["computeResource"] = Utilities::get_compute_resource($scheduling->resourceHostId);
}
$expVal["applicationInterface"] = Utilities::get_application_interface($experiment->applicationId);
switch ($experimentStatusString)
{
case 'CREATED':
case 'VALIDATED':
case 'SCHEDULED':
case 'CANCELED':
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;
}