当前位置: 首页>>代码示例>>PHP>>正文


PHP Utilities::get_compute_resource方法代码示例

本文整理汇总了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);
 }
开发者ID:sanyaade-iot,项目名称:airavata-php-gateway,代码行数:86,代码来源:ComputeResource.php

示例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.");
    }
}
开发者ID:sanyaade-iot,项目名称:airavata-php-gateway,代码行数:57,代码来源:CRUtilities.php

示例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;

}
开发者ID:sanyaade-iot,项目名称:airavata-php-gateway,代码行数:71,代码来源:ExpUtilities.php


注:本文中的Utilities::get_compute_resource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。