/**
 * Define configuration constants
 */
public static function register_or_update_compute_resource( $computeDescription, $update = false)
{
    if( $update)
    {
        $computeResourceId = $computeDescription->computeResourceId;

        if( Airavata::updateComputeResource( $computeResourceId, $computeDescription) )
        {
            $computeResource = Airavata::getComputeResource( $computeResourceId);
            return $computeResource;
        }
        else
            print_r( "Something went wrong while updating!"); exit;
    }
    else
    {
        /*
        $fileSystems = new FileSystems();
        foreach( $fileSystems as $fileSystem)
            $computeDescription["fileSystems"][$fileSystem] = "";
        */
        $cd = new ComputeResourceDescription( $computeDescription);
        $computeResourceId = Airavata::registerComputeResource( $cd);
    }

    $computeResource = Airavata::getComputeResource( $computeResourceId);
    return $computeResource;

}
Пример #2
0
 /**
  * Define configuration constants
  */
 public static function register_or_update_compute_resource($computeDescription, $update = false)
 {
     if ($update) {
         $computeResourceId = $computeDescription->computeResourceId;
         if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
             if (Cache::has('CR-' . $computeResourceId)) {
                 Cache::forget('CR-' . $computeResourceId);
             }
         }
         if (Airavata::updateComputeResource(Session::get('authz-token'), $computeResourceId, $computeDescription)) {
             $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $computeResourceId);
             return $computeResource;
         } else {
             print_r("Something went wrong while updating!");
         }
         exit;
     } else {
         /*
         $fileSystems = new FileSystems();
         foreach( $fileSystems as $fileSystem)
             $computeDescription["fileSystems"][$fileSystem] = "";
         */
         $cd = new ComputeResourceDescription($computeDescription);
         $computeResourceId = Airavata::registerComputeResource(Session::get('authz-token'), $cd);
     }
     $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $computeResourceId);
     return $computeResource;
 }