001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.reef.runtime.hdinsight.client.yarnrest; 020 021/** 022 * Represents an ApplicationSubmission to the YARN REST API. 023 */ 024public final class ApplicationSubmission { 025 026 public static final String DEFAULT_QUEUE = "default"; 027 private String queue = DEFAULT_QUEUE; 028 029 public static final String DEFAULT_PRIORITY = "3"; 030 private String priority = DEFAULT_PRIORITY; 031 032 public static final String DEFAULT_MAX_ATTEMPTS = "1"; 033 private String maxAppAttempts = DEFAULT_MAX_ATTEMPTS; 034 035 public static final String DEFAULT_APPLICATION_TYPE = "YARN"; 036 private String applicationType = DEFAULT_APPLICATION_TYPE; 037 038 public static final String DEFAULT_KEEP_CONTAINERS = "false"; 039 private String keepContainers = DEFAULT_KEEP_CONTAINERS; 040 041 public static final String DEFAULT_IS_UNMANAGED_AM = "false"; 042 private String isUnmanagedAM = DEFAULT_IS_UNMANAGED_AM; 043 044 public static final String DEFAULT_CANCEL_TOKENS_WHEN_COMPLETE = "true"; 045 private String cancelTokensWhenComplete = DEFAULT_CANCEL_TOKENS_WHEN_COMPLETE; 046 047 private String applicationId; 048 private String applicationName; 049 private ContainerInfo containerInfo; 050 private Resource resource; 051 052 public String getApplicationId() { 053 return applicationId; 054 } 055 056 public ApplicationSubmission setApplicationId(String applicationId) { 057 this.applicationId = applicationId; 058 return this; 059 } 060 061 public String getApplicationName() { 062 return applicationName; 063 } 064 065 public ApplicationSubmission setApplicationName(String applicationName) { 066 this.applicationName = applicationName; 067 return this; 068 } 069 070 public String getApplicationType() { 071 return applicationType; 072 } 073 074 public ApplicationSubmission setApplicationType(String applicationType) { 075 this.applicationType = applicationType; 076 return this; 077 } 078 079 public String isCancelTokensWhenComplete() { 080 return cancelTokensWhenComplete; 081 } 082 083 public ApplicationSubmission setCancelTokensWhenComplete(String cancelTokensWhenComplete) { 084 this.cancelTokensWhenComplete = cancelTokensWhenComplete; 085 return this; 086 } 087 088 public ContainerInfo getContainerInfo() { 089 return containerInfo; 090 } 091 092 public ApplicationSubmission setContainerInfo(ContainerInfo containerInfo) { 093 this.containerInfo = containerInfo; 094 return this; 095 } 096 097 public String isUnmanagedAM() { 098 return isUnmanagedAM; 099 } 100 101 public ApplicationSubmission setUnmanagedAM(String isUnmanagedAM) { 102 this.isUnmanagedAM = isUnmanagedAM; 103 return this; 104 } 105 106 public String isKeepContainers() { 107 return keepContainers; 108 } 109 110 public ApplicationSubmission setKeepContainers(String keepContainers) { 111 this.keepContainers = keepContainers; 112 return this; 113 } 114 115 public String getMaxAppAttempts() { 116 return maxAppAttempts; 117 } 118 119 public ApplicationSubmission setMaxAppAttempts(String maxAppAttempts) { 120 this.maxAppAttempts = maxAppAttempts; 121 return this; 122 } 123 124 public String getPriority() { 125 return priority; 126 } 127 128 public ApplicationSubmission setPriority(String priority) { 129 this.priority = priority; 130 return this; 131 } 132 133 public String getQueue() { 134 return queue; 135 } 136 137 public ApplicationSubmission setQueue(String queue) { 138 this.queue = queue; 139 return this; 140 } 141 142 public Resource getResource() { 143 return resource; 144 } 145 146 public ApplicationSubmission setResource(Resource resource) { 147 this.resource = resource; 148 return this; 149 } 150 151 @Override 152 public String toString() { 153 return "ApplicationSubmission{" + 154 "queue='" + queue + '\'' + 155 ", priority=" + priority + 156 ", maxAppAttempts=" + maxAppAttempts + 157 ", applicationType='" + applicationType + '\'' + 158 ", keepContainers=" + keepContainers + 159 ", applicationId='" + applicationId + '\'' + 160 ", applicationName='" + applicationName + '\'' + 161 ", containerInfo=" + containerInfo + 162 ", isUnmanagedAM=" + isUnmanagedAM + 163 ", cancelTokensWhenComplete=" + cancelTokensWhenComplete + 164 ", resource=" + resource + 165 '}'; 166 } 167}