public Object getFieldValue(_Fields field) { switch (field) { case COMPUTE_RESOURCE_ID: return getComputeResourceId(); return getHostName(); return getHostAliases(); return getIpAddresses(); return getResourceDescription(); return isEnabled(); return getBatchQueues(); return getFileSystems(); return getJobSubmissionInterfaces(); return getDataMovementInterfaces(); return getMaxMemoryPerNode(); return isGatewayUsageReporting(); return getGatewayUsageModuleLoadCommand(); return getGatewayUsageExecutable();
public static ComputeResourceDescription createComputeResourceDescription( String hostName, List<String> hostAliases, List<String> ipAddresses) { ComputeResourceDescription host = new ComputeResourceDescription(); host.setHostName(hostName); host.setIpAddresses(ipAddresses); host.setHostAliases(hostAliases); return host; }
case COMPUTE_RESOURCE_ID: if (value == null) { unsetComputeResourceId(); } else { setComputeResourceId((String)value); unsetHostName(); } else { setHostName((String)value); unsetHostAliases(); } else { setHostAliases((List<String>)value); unsetIpAddresses(); } else { setIpAddresses((List<String>)value); unsetResourceDescription(); } else { setResourceDescription((String)value); unsetEnabled(); } else { setEnabled((Boolean)value); unsetBatchQueues(); } else { setBatchQueues((List<BatchQueue>)value);
private static boolean isEqual(ComputeResourceDescription comRes_1, ComputeResourceDescription comRes_2) { return comRes_1.getComputeResourceId().equals(comRes_2.getComputeResourceId()) && comRes_1.getHostName().equals(comRes_2.getHostName()); }
public Object getFieldValue(_Fields field) { switch (field) { case COMPUTE_RESOURCE_ID: return getComputeResourceId(); return getHostName(); return getHostAliases(); return getIpAddresses(); return getResourceDescription(); return isEnabled(); return getBatchQueues(); return getFileSystems(); return getJobSubmissionInterfaces(); return getDataMovementInterfaces(); return getMaxMemoryPerNode(); return isGatewayUsageReporting(); return getGatewayUsageModuleLoadCommand(); return getGatewayUsageExecutable();
public static ComputeResourceDescription getComputeHostDescription (ComputeResourceResource resource) throws AppCatalogException { ComputeResourceDescription description = new ComputeResourceDescription(); description.setComputeResourceId(resource.getResourceId()); description.setHostName(resource.getHostName()); description.setResourceDescription(resource.getResourceDescription()); description.setMaxMemoryPerNode(resource.getMaxMemoryPerNode()); description.setEnabled(resource.isEnabled()); description.setGatewayUsageReporting(resource.isGatewayUsageReporting()); description.setGatewayUsageExecutable(resource.getGatewayUsageExec()); description.setGatewayUsageModuleLoadCommand(resource.getGatewayUsageModLoadCMD()); HostAliasAppResource aliasResource = new HostAliasAppResource(); List<AppCatalogResource> resources = aliasResource.get(AppCatAbstractResource.HostAliasConstants.RESOURCE_ID, resource.getResourceId()); if (resources != null && !resources.isEmpty()){ description.setHostAliases(getHostAliases(resources)); description.setIpAddresses(getIpAddresses(ipAddresses)); List<AppCatalogResource> batchQueues = bqResource.get(AppCatAbstractResource.BatchQueueConstants.COMPUTE_RESOURCE_ID, resource.getResourceId()); if (batchQueues != null && !batchQueues.isEmpty()){ description.setBatchQueues(getBatchQueues(batchQueues)); description.setFileSystems(new HashMap<FileSystems,String>()); if (fsList != null && !fsList.isEmpty()){ for (AppCatalogResource r : fsList) { ComputeResourceFileSystemResource rr=(ComputeResourceFileSystemResource)r; description.getFileSystems().put(FileSystems.valueOf(rr.getFileSystem()), rr.getPath()); List<AppCatalogResource> hsiList = jsiResource.get(AppCatAbstractResource.JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, resource.getResourceId()); if (hsiList != null && !hsiList.isEmpty()){ description.setJobSubmissionInterfaces(getJobSubmissionInterfaces(hsiList));
case COMPUTE_RESOURCE_ID: if (value == null) { unsetComputeResourceId(); } else { setComputeResourceId((String)value); unsetHostName(); } else { setHostName((String)value); unsetHostAliases(); } else { setHostAliases((List<String>)value); unsetIpAddresses(); } else { setIpAddresses((List<String>)value); unsetResourceDescription(); } else { setResourceDescription((String)value); unsetEnabled(); } else { setEnabled((Boolean)value); unsetBatchQueues(); } else { setBatchQueues((List<BatchQueue>)value);
public static ComputeResourceResource getComputeHostResource (ComputeResourceDescription description){ ComputeResourceResource resource = new ComputeResourceResource(); resource.setHostName(description.getHostName()); resource.setResourceDescription(description.getResourceDescription()); resource.setResourceId(description.getComputeResourceId()); resource.setMaxMemoryPerNode(description.getMaxMemoryPerNode()); resource.setEnabled(description.isEnabled()); resource.setGatewayUsageReporting(description.isGatewayUsageReporting()); resource.setGatewayUsageExec(description.getGatewayUsageExecutable()); resource.setGatewayUsageModLoadCMD(description.getGatewayUsageModuleLoadCommand()); return resource; }
public static ComputeResourceResource getComputeHostResource (ComputeResourceDescription description){ ComputeResourceResource resource = new ComputeResourceResource(); resource.setHostName(description.getHostName()); resource.setResourceDescription(description.getResourceDescription()); resource.setResourceId(description.getComputeResourceId()); resource.setMaxMemoryPerNode(description.getMaxMemoryPerNode()); resource.setEnabled(description.isEnabled()); return resource; }
@Override public String addComputeResource(ComputeResourceDescription description) throws AppCatalogException { try { if (description.getComputeResourceId().equals("") || description.getComputeResourceId().equals(compute_resource_modelConstants.DEFAULT_ID)){ description.setComputeResourceId(AppCatalogUtils.getID(description.getHostName())); } return saveComputeResourceDescriptorData(description); } catch (Exception e) { logger.error("Error while saving compute resource...", e); throw new AppCatalogException(e); } }
/** * Construct and return the path for a given MonitorID , eg: /stat/{username}/{resourceName}/job * @param monitorID - Job monitorId * @return */ public static String getJobCountUpdatePath(MonitorID monitorID){ return new StringBuilder("/").append(Constants.STAT).append("/").append(monitorID.getUserName()) .append("/").append(monitorID.getComputeResourceDescription().getHostName()).append("/").append(Constants.JOB).toString(); }
if (computeResourceDescription.isSetIpAddresses() && computeResourceDescription.getIpAddresses().size() > 0) { String hostAddress = computeResourceDescription.getIpAddresses().get(0); " , ComputeResourceDescription " + computeResourceDescription.getHostName() + " doesn't has an " + "IpAddress with it");
protected void saveIpAddresses(ComputeResourceDescription description, ComputeResourceResource computeHostResource) throws AppCatalogException { List<String> ipAddresses = description.getIpAddresses(); HostIPAddressResource resource = new HostIPAddressResource(); resource.remove(description.getComputeResourceId()); if (ipAddresses != null && !ipAddresses.isEmpty()) { for (String ipAddress : ipAddresses) { HostIPAddressResource ipAddressResource = new HostIPAddressResource(); ipAddressResource.setComputeHostResource(computeHostResource); ipAddressResource.setResourceID(computeHostResource.getResourceId()); ipAddressResource.setIpaddress(ipAddress); ipAddressResource.save(); } } }
protected void saveHostAliases(ComputeResourceDescription description, ComputeResourceResource computeHostResource) throws AppCatalogException { List<String> hostAliases = description.getHostAliases(); // delete previous host aliases HostAliasAppResource resource = new HostAliasAppResource(); resource.remove(description.getComputeResourceId()); if (hostAliases != null && !hostAliases.isEmpty()) { for (String alias : hostAliases) { HostAliasAppResource aliasResource = new HostAliasAppResource(); aliasResource.setComputeHostResource(computeHostResource); aliasResource.setResourceID(computeHostResource.getResourceId()); aliasResource.setAlias(alias); aliasResource.save(); } } }
public static JobSubmissionInterface getPreferredJobSubmissionInterface(ProcessContext context) throws AppCatalogException { try { String resourceHostId = context.getComputeResourceDescription().getComputeResourceId(); ComputeResourcePreference resourcePreference = context.getComputeResourcePreference(); JobSubmissionProtocol preferredJobSubmissionProtocol = resourcePreference.getPreferredJobSubmissionProtocol(); ComputeResourceDescription resourceDescription = context.getAppCatalog().getComputeResource().getComputeResource(resourceHostId); List<JobSubmissionInterface> jobSubmissionInterfaces = resourceDescription.getJobSubmissionInterfaces(); Map<JobSubmissionProtocol, List<JobSubmissionInterface>> orderedInterfaces = new HashMap<>(); List<JobSubmissionInterface> interfaces = new ArrayList<>();
public String getComputeResourceId() { return getComputeResourceDescription().getComputeResourceId(); }
public ComputeResourceDescription deepCopy() { return new ComputeResourceDescription(this); }
ComputeResourceDescription computeResourceDescription = appCatalog.getComputeResource() .getComputeResource(compResourceId); if(!computeResourceDescription.isEnabled()){ logger.error("Compute Resource is not enabled by the Admin!"); AiravataSystemException exception = new AiravataSystemException();
protected void saveJobSubmissionInterfaces( ComputeResourceDescription description, ComputeResourceResource computeHostResource) throws AppCatalogException { List<JobSubmissionInterface> jobSubmissionInterfaces = description.getJobSubmissionInterfaces(); if (jobSubmissionInterfaces != null && !jobSubmissionInterfaces.isEmpty()) { for (JobSubmissionInterface jobSubmissionInterface : jobSubmissionInterfaces) { JobSubmissionInterfaceResource jsir = AppCatalogThriftConversion.getJobSubmissionInterface(jobSubmissionInterface); jsir.setComputeHostResource(computeHostResource); jsir.setComputeResourceId(computeHostResource.getResourceId()); jsir.save(); } } }
public static void registerLocalHost() { try { System.out.println("\n #### Registering Localhost Computational Resource #### \n"); ComputeResourceDescription computeResourceDescription = RegisterSampleApplicationsUtils. createComputeResourceDescription("localhost", "LocalHost", null, null); List<String> hostAliases = new ArrayList<String>(); hostAliases.add("alias1"); hostAliases.add("alias2"); computeResourceDescription.setHostAliases(hostAliases); localhostId = airavataClient.registerComputeResource(new AuthzToken(""), computeResourceDescription); ResourceJobManager resourceJobManager = RegisterSampleApplicationsUtils. createResourceJobManager(ResourceJobManagerType.FORK, null, null, null); LOCALSubmission submission = new LOCALSubmission(); submission.setResourceJobManager(resourceJobManager); airavataClient.addLocalSubmissionDetails(new AuthzToken(""), localhostId, 1, submission); System.out.println("LocalHost Resource Id is " + localhostId); } catch (TException e) { e.printStackTrace(); } }