Repository: incubator-reef
Updated Branches:
  refs/heads/master 23f677d0c -> db8dd549f


[REEF-782] Allow REEF .NET Client to setup security token for Hadoop

This addressed the issue by
 * Defining file names for token id and password handshake between .NET
 * client and java client
 * Defining new commandline parameters for token kind and token service
 * and passing it to Java launcher
 * Setting the tokens into user credentials when user expresses such
 * intent by passing the token kind

JIRA:
 [REEF-782](https://issues.apache.org/jira/browse/REEF-782)

 This closes #523

Anupam <anupam...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/db8dd549
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/db8dd549
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/db8dd549

Branch: refs/heads/master
Commit: db8dd549f60bbeee12b632b75187ab52914ada0f
Parents: 23f677d
Author: Anupam <anupam...@gmail.com>
Authored: Tue Sep 22 14:28:55 2015 -0700
Committer: Julia Wang <jul...@apache.org>
Committed: Thu Sep 24 17:02:05 2015 -0700

----------------------------------------------------------------------
 .../Org.Apache.REEF.Client.csproj               |  2 +
 .../JobSubmissionDirectoryPrefixParameter.cs    | 26 ++++++++++++
 .../YARN/Parameters/SecurityTokenParameters.cs  | 31 ++++++++++++++
 .../YARN/YARNClientConfiguration.cs             | 10 +++++
 .../YARN/YARNREEFClient.cs                      | 33 +++++++++++----
 .../Files/REEFFileNames.cs                      | 22 ++++++++++
 .../bridge/client/YarnJobSubmissionClient.java  | 27 ++++++++++++
 .../bridge/client/YarnSubmissionFromCS.java     | 43 +++++++++++++++++++-
 .../runtime/common/files/REEFFileNames.java     | 15 +++++++
 9 files changed, 199 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/db8dd549/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj 
b/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
index 8fcbb73..ff839b5 100644
--- a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
+++ b/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
@@ -77,6 +77,8 @@ under the License.
     <Compile Include="Local\Parameters\LocalRuntimeDirectory.cs" />
     <Compile Include="Local\Parameters\NumberOfEvaluators.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile 
Include="YARN\Parameters\JobSubmissionDirectoryPrefixParameter.cs" />
+    <Compile Include="YARN\Parameters\SecurityTokenParameters.cs" />
     <Compile Include="YARN\YARNREEFClient.cs" />
     <Compile Include="YARN\RestClient\IRestClientFactory.cs" />
     <Compile Include="YARN\RestClient\RestRequestExecutor.cs" />

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/db8dd549/lang/cs/Org.Apache.REEF.Client/YARN/Parameters/JobSubmissionDirectoryPrefixParameter.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Client/YARN/Parameters/JobSubmissionDirectoryPrefixParameter.cs
 
b/lang/cs/Org.Apache.REEF.Client/YARN/Parameters/JobSubmissionDirectoryPrefixParameter.cs
new file mode 100644
index 0000000..58f55e6
--- /dev/null
+++ 
b/lang/cs/Org.Apache.REEF.Client/YARN/Parameters/JobSubmissionDirectoryPrefixParameter.cs
@@ -0,0 +1,26 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Client.YARN.Parameters
+{
+    [NamedParameter("Directory used to upload job resources from the client", 
defaultValue: @"/vol1/tmp")]
+    public class JobSubmissionDirectoryPrefixParameter : Name<string>
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/db8dd549/lang/cs/Org.Apache.REEF.Client/YARN/Parameters/SecurityTokenParameters.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Client/YARN/Parameters/SecurityTokenParameters.cs 
b/lang/cs/Org.Apache.REEF.Client/YARN/Parameters/SecurityTokenParameters.cs
new file mode 100644
index 0000000..5d97088
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Client/YARN/Parameters/SecurityTokenParameters.cs
@@ -0,0 +1,31 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Client.YARN.Parameters
+{
+    [NamedParameter("Security token kind.", defaultValue:"NULL")]
+    public sealed class SecurityTokenKindParameter : Name<string>
+    {
+    }
+
+    [NamedParameter("Security token service name.", defaultValue: "NULL")]
+    public sealed class SecurityTokenServiceParameter : Name<string>
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/db8dd549/lang/cs/Org.Apache.REEF.Client/YARN/YARNClientConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/YARN/YARNClientConfiguration.cs 
b/lang/cs/Org.Apache.REEF.Client/YARN/YARNClientConfiguration.cs
index 321ee94..2382875 100644
--- a/lang/cs/Org.Apache.REEF.Client/YARN/YARNClientConfiguration.cs
+++ b/lang/cs/Org.Apache.REEF.Client/YARN/YARNClientConfiguration.cs
@@ -16,7 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 using Org.Apache.REEF.Client.API;
+using Org.Apache.REEF.Client.YARN;
+using Org.Apache.REEF.Client.YARN.Parameters;
 using Org.Apache.REEF.Tang.Formats;
 using Org.Apache.REEF.Tang.Util;
 
@@ -27,8 +30,15 @@ namespace Org.Apache.REEF.Client.Yarn
     /// </summary>
     public sealed class YARNClientConfiguration : ConfigurationModuleBuilder
     {
+        public static readonly OptionalParameter<string> 
JobSubmissionFolderPrefix = new OptionalParameter<string>();
+        public static readonly OptionalParameter<string> SecurityTokenKind = 
new OptionalParameter<string>();
+        public static readonly OptionalParameter<string> SecurityTokenService 
= new OptionalParameter<string>();
+
         public static ConfigurationModule ConfigurationModule = new 
YARNClientConfiguration()
             .BindImplementation(GenericType<IREEFClient>.Class, 
GenericType<YarnREEFClient>.Class)
+            
.BindNamedParameter(GenericType<JobSubmissionDirectoryPrefixParameter>.Class, 
JobSubmissionFolderPrefix)
+            .BindNamedParameter(GenericType<SecurityTokenKindParameter>.Class, 
SecurityTokenKind)
+            
.BindNamedParameter(GenericType<SecurityTokenServiceParameter>.Class, 
SecurityTokenService)
             .Build();
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/db8dd549/lang/cs/Org.Apache.REEF.Client/YARN/YARNREEFClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/YARN/YARNREEFClient.cs 
b/lang/cs/Org.Apache.REEF.Client/YARN/YARNREEFClient.cs
index ff17af8..75a1834 100644
--- a/lang/cs/Org.Apache.REEF.Client/YARN/YARNREEFClient.cs
+++ b/lang/cs/Org.Apache.REEF.Client/YARN/YARNREEFClient.cs
@@ -22,6 +22,8 @@ using System.IO;
 using System.Linq;
 using Org.Apache.REEF.Client.API;
 using Org.Apache.REEF.Client.Common;
+using Org.Apache.REEF.Client.YARN;
+using Org.Apache.REEF.Client.YARN.Parameters;
 using Org.Apache.REEF.Common.Files;
 using Org.Apache.REEF.Tang.Annotations;
 using Org.Apache.REEF.Tang.Implementations.Tang;
@@ -39,6 +41,9 @@ namespace Org.Apache.REEF.Client.Yarn
         private static readonly Logger Logger = 
Logger.GetLogger(typeof(YarnREEFClient));
         private readonly DriverFolderPreparationHelper 
_driverFolderPreparationHelper;
         private readonly JavaClientLauncher _javaClientLauncher;
+        private readonly string _securityTokenKind;
+        private readonly string _securityTokenService;
+        private readonly string _jobSubmissionPrefix;
         private String _driverUrl;
         private REEFFileNames _fileNames;
 
@@ -46,8 +51,14 @@ namespace Org.Apache.REEF.Client.Yarn
         internal YarnREEFClient(JavaClientLauncher javaClientLauncher,
             DriverFolderPreparationHelper driverFolderPreparationHelper,
             REEFFileNames fileNames,
-            YarnCommandLineEnvironment yarn)
+            YarnCommandLineEnvironment yarn,
+            [Parameter(typeof(SecurityTokenKindParameter))] string 
securityTokenKind,
+            [Parameter(typeof(SecurityTokenServiceParameter))] string 
securityTokenService,
+            [Parameter(typeof(JobSubmissionDirectoryPrefixParameter))] string 
jobSubmissionPrefix)
         {
+            _jobSubmissionPrefix = jobSubmissionPrefix;
+            _securityTokenKind = securityTokenKind;
+            _securityTokenService = securityTokenService;
             _javaClientLauncher = javaClientLauncher;
             _javaClientLauncher.AddToClassPath(yarn.GetYarnClasspathList());
             _driverFolderPreparationHelper = driverFolderPreparationHelper;
@@ -89,13 +100,19 @@ namespace Org.Apache.REEF.Client.Yarn
                 .GetInstance<ClrClient2JavaClientCuratedParameters>();
 
             // Submit the driver
-            _javaClientLauncher.Launch(JavaClassName, driverFolderPath, 
jobSubmission.JobIdentifier,
-                jobSubmission.DriverMemory.ToString(),
-                javaParams.TcpPortRangeStart.ToString(),
-                javaParams.TcpPortRangeCount.ToString(),
-                javaParams.TcpPortRangeTryCount.ToString(),
-                javaParams.MaxApplicationSubmissions.ToString(),
-                javaParams.DriverRestartEvaluatorRecoverySeconds.ToString()
+            _javaClientLauncher.Launch(
+                JavaClassName,
+                driverFolderPath, // arg: 0
+                jobSubmission.JobIdentifier, // arg: 1
+                jobSubmission.DriverMemory.ToString(), // arg: 2
+                javaParams.TcpPortRangeStart.ToString(), // arg: 3
+                javaParams.TcpPortRangeCount.ToString(), // arg: 4
+                javaParams.TcpPortRangeTryCount.ToString(), // arg: 5
+                javaParams.MaxApplicationSubmissions.ToString(), // arg: 6
+                javaParams.DriverRestartEvaluatorRecoverySeconds.ToString(), 
// arg: 7
+                _securityTokenKind, // arg: 8
+                _securityTokenService, // arg: 9
+                _jobSubmissionPrefix // arg: 10
                 );
             Logger.Log(Level.Info, "Submitted the Driver for execution." + 
jobSubmission.JobIdentifier);
         }

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/db8dd549/lang/cs/Org.Apache.REEF.Common/Files/REEFFileNames.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Common/Files/REEFFileNames.cs 
b/lang/cs/Org.Apache.REEF.Common/Files/REEFFileNames.cs
index 15ddd02..72a1b65 100644
--- a/lang/cs/Org.Apache.REEF.Common/Files/REEFFileNames.cs
+++ b/lang/cs/Org.Apache.REEF.Common/Files/REEFFileNames.cs
@@ -52,6 +52,8 @@ namespace Org.Apache.REEF.Common.Files
         private const string DRIVER_HTTP_ENDPOINT_FILE_NAME = 
"DriverHttpEndpoint.txt";
         private const string BRIDGE_EXE_NAME = "Org.Apache.REEF.Bridge.exe";
         private const string BRIDGE_EXE_CONFIG_NAME = 
"Org.Apache.REEF.Bridge.exe.config";
+        private const string SECURITY_TOKEN_IDENTIFIER_FILE = 
"SecurityTokenId";
+        private const string SECURITY_TOKEN_PASSWORD_FILE = "SecurityTokenPwd";
 
         [Inject]
         public REEFFileNames()
@@ -232,6 +234,26 @@ namespace Org.Apache.REEF.Common.Files
         }
 
         /// <summary>
+        /// The filename for security token identifier
+        /// </summary>
+        /// <returns>filename which contains raw bytes of security token 
identifier</returns>
+        [Unstable("0.13", "Security token should be handled by .NET only REEF 
client in the future")]
+        public string GetSecurityTokenIdentifierFileName()
+        {
+            return SECURITY_TOKEN_IDENTIFIER_FILE;
+        }
+
+        /// <summary>
+        /// The filename for security token password
+        /// </summary>
+        /// <returns>filename which contains raw bytes of security token 
password</returns>
+        [Unstable("0.13", "Security token should be handled by .NET only REEF 
client in the future")]
+        public string GetSecurityTokenPasswordFileName()
+        {
+            return SECURITY_TOKEN_PASSWORD_FILE;
+        }
+
+        /// <summary>
         /// </summary>
         /// <returns>File name that contains the dfs path for the 
DriverHttpEndpoint</returns>
         [Unstable("0.13", "Working in progress for what to return after 
submit")]

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/db8dd549/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnJobSubmissionClient.java
----------------------------------------------------------------------
diff --git 
a/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnJobSubmissionClient.java
 
b/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnJobSubmissionClient.java
index 4708bb4..f27401e 100644
--- 
a/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnJobSubmissionClient.java
+++ 
b/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnJobSubmissionClient.java
@@ -19,6 +19,9 @@
 package org.apache.reef.bridge.client;
 
 import org.apache.hadoop.fs.*;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.yarn.api.records.LocalResource;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnException;
@@ -47,6 +50,8 @@ import org.apache.reef.util.JARFileMaker;
 import javax.inject.Inject;
 import java.io.*;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.List;
 import java.util.Set;
 import java.util.logging.Level;
@@ -209,6 +214,19 @@ public final class YarnJobSubmissionClient {
     }
   }
 
+  private static void writeSecurityTokenToUserCredential(final 
YarnSubmissionFromCS yarnSubmission) throws IOException {
+    final UserGroupInformation currentUser = 
UserGroupInformation.getCurrentUser();
+    final REEFFileNames fileNames = new REEFFileNames();
+    final String securityTokenIdentifierFile = 
fileNames.getSecurityTokenIdentifierFile();
+    final String securityTokenPasswordFile = 
fileNames.getSecurityTokenPasswordFile();
+    final Text tokenKind = new Text(yarnSubmission.getTokenKind());
+    final Text tokenService = new Text(yarnSubmission.getTokenService());
+    byte[] identifier = 
Files.readAllBytes(Paths.get(securityTokenIdentifierFile));
+    byte[] password = Files.readAllBytes(Paths.get(securityTokenPasswordFile));
+    Token token = new Token(identifier, password, tokenKind, tokenService);
+    currentUser.addToken(token);
+  }
+
   /**
    * We leave a file behind in job submission directory so that clr client can 
figure out
    * the applicationId and yarn rest endpoint.
@@ -281,6 +299,15 @@ public final class YarnJobSubmissionClient {
   public static void main(final String[] args) throws InjectionException, 
IOException, YarnException {
     final YarnSubmissionFromCS yarnSubmission = 
YarnSubmissionFromCS.fromCommandLine(args);
     LOG.log(Level.INFO, "YARN job submission received from C#: {0}", 
yarnSubmission);
+    if (!yarnSubmission.getTokenKind().equalsIgnoreCase("NULL")) {
+      // We have to write security token to user credential before 
YarnJobSubmissionClient is created
+      // as that will need initialization of FileSystem which could need the 
token.
+      LOG.log(Level.INFO, "Writing security token to user credential");
+      writeSecurityTokenToUserCredential(yarnSubmission);
+    } else{
+      LOG.log(Level.FINE, "Did not find security token");
+    }
+
     final Configuration yarnConfiguration = 
yarnSubmission.getRuntimeConfiguration();
     final YarnJobSubmissionClient client = Tang.Factory.getTang()
         .newInjector(yarnConfiguration)

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/db8dd549/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnSubmissionFromCS.java
----------------------------------------------------------------------
diff --git 
a/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnSubmissionFromCS.java
 
b/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnSubmissionFromCS.java
index eb21a37..2ab6c9b 100644
--- 
a/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnSubmissionFromCS.java
+++ 
b/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnSubmissionFromCS.java
@@ -25,6 +25,7 @@ import org.apache.reef.io.TcpPortConfigurationProvider;
 import org.apache.reef.runtime.common.files.REEFFileNames;
 import 
org.apache.reef.runtime.common.launch.parameters.DriverLaunchCommandPrefix;
 import org.apache.reef.runtime.yarn.client.YarnClientConfiguration;
+import 
org.apache.reef.runtime.yarn.driver.parameters.JobSubmissionDirectoryPrefix;
 import org.apache.reef.tang.Configuration;
 import org.apache.reef.tang.Configurations;
 import org.apache.reef.tang.Tang;
@@ -54,6 +55,9 @@ final class YarnSubmissionFromCS {
   // Static for now
   private final int priority;
   private final String queue;
+  private final String tokenKind;
+  private final String tokenService;
+  private final String jobSubmissionDirectoryPrefix;
 
   private YarnSubmissionFromCS(final File driverFolder,
                                final String jobId,
@@ -64,7 +68,10 @@ final class YarnSubmissionFromCS {
                                final int maxApplicationSubmissions,
                                final int driverRecoveryTimeout,
                                final int priority,
-                               final String queue) {
+                               final String queue,
+                               final String tokenKind,
+                               final String tokenService,
+                               final String jobSubmissionDirectoryPrefix) {
 
     Validate.isTrue(driverFolder.exists(), "The driver folder given does not 
exist.");
     Validate.notEmpty(jobId, "The job id is null or empty");
@@ -74,6 +81,9 @@ final class YarnSubmissionFromCS {
     Validate.isTrue(tcpTryCount > 0, "The tcp retry count given is <= 0.");
     Validate.isTrue(maxApplicationSubmissions > 0, "The maximum number of app 
submissions given is <= 0.");
     Validate.notEmpty(queue, "The queue is null or empty");
+    Validate.notEmpty(tokenKind, "Token kind should be either NULL or some 
custom non empty value");
+    Validate.notEmpty(tokenService, "Token service should be either NULL or 
some custom non empty value");
+    Validate.notEmpty(jobSubmissionDirectoryPrefix, "Job submission directory 
prefix should not be empty");
 
     this.driverFolder = driverFolder;
     this.jobId = jobId;
@@ -85,6 +95,9 @@ final class YarnSubmissionFromCS {
     this.driverRecoveryTimeout = driverRecoveryTimeout;
     this.priority = priority;
     this.queue = queue;
+    this.tokenKind = tokenKind;
+    this.tokenService = tokenService;
+    this.jobSubmissionDirectoryPrefix = jobSubmissionDirectoryPrefix;
   }
 
   @Override
@@ -100,6 +113,9 @@ final class YarnSubmissionFromCS {
         ", driverRecoveryTimeout=" + driverRecoveryTimeout +
         ", priority=" + priority +
         ", queue='" + queue + '\'' +
+        ", tokenKind='" + tokenKind + '\'' +
+        ", tokenService='" + tokenService + '\'' +
+        ", jobSubmissionDirectoryPrefix='" + jobSubmissionDirectoryPrefix + 
'\'' +
         '}';
   }
 
@@ -114,6 +130,7 @@ final class YarnSubmissionFromCS {
         .bindNamedParameter(TcpPortRangeBegin.class, 
Integer.toString(tcpBeginPort))
         .bindNamedParameter(TcpPortRangeCount.class, 
Integer.toString(tcpRangeCount))
         .bindNamedParameter(TcpPortRangeTryCount.class, 
Integer.toString(tcpTryCount))
+        .bindNamedParameter(JobSubmissionDirectoryPrefix.class, 
jobSubmissionDirectoryPrefix)
         .build();
 
     final List<String> driverLaunchCommandPrefixList = new ArrayList<>();
@@ -166,6 +183,20 @@ final class YarnSubmissionFromCS {
   }
 
   /**
+   * @return The security token kind
+   */
+  String getTokenKind() {
+    return tokenKind;
+  }
+
+  /**
+   * @return The security token service
+   */
+  String getTokenService() {
+    return tokenService;
+  }
+
+  /**
    * Takes 5 parameters from the C# side:
    * [0]: String. Driver folder.
    * [1]: String. Driver identifier.
@@ -173,6 +204,9 @@ final class YarnSubmissionFromCS {
    * [3~5]: int. TCP configurations.
    * [6]: int. Max application submissions.
    * [7]: int. Evaluator recovery timeout for driver restart. > 0 => restart 
is enabled.
+   * [8]: string: Security token kind. "NULL" => No security token is used
+   * [9]: string: Security token service. "NULL" => No security token is used
+   * [10]: string: Job submission directory prefix.
    */
   static YarnSubmissionFromCS fromCommandLine(final String[] args) {
     final File driverFolder = new File(args[0]);
@@ -183,10 +217,15 @@ final class YarnSubmissionFromCS {
     final int tcpTryCount = Integer.parseInt(args[5]);
     final int maxApplicationSubmissions = Integer.parseInt(args[6]);
     final int driverRecoveryTimeout = Integer.parseInt(args[7]);
+    final String securityTokenKind = args[8];
+    final String securityTokenService = args[9];
+    final String jobSubmissionDirectoryPrefix = args[10];
+
     // Static for now
     final int priority = 1;
     final String queue = "default";
     return new YarnSubmissionFromCS(driverFolder, jobId, driverMemory, 
tcpBeginPort, tcpRangeCount, tcpTryCount,
-        maxApplicationSubmissions, driverRecoveryTimeout, priority, queue);
+        maxApplicationSubmissions, driverRecoveryTimeout, priority, queue, 
securityTokenKind, securityTokenService,
+        jobSubmissionDirectoryPrefix);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/db8dd549/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/REEFFileNames.java
----------------------------------------------------------------------
diff --git 
a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/REEFFileNames.java
 
b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/REEFFileNames.java
index 2c93e22..8f31fa2 100644
--- 
a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/REEFFileNames.java
+++ 
b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/REEFFileNames.java
@@ -49,6 +49,8 @@ public final class REEFFileNames {
   private static final String EVALUATOR_STDOUT = "evaluator.stdout";
   private static final String DRIVER_HTTP_ENDPOINT_FILE_NAME = 
"DriverHttpEndpoint.txt";
   private static final String BRIDGE_EXE_NAME = "Org.Apache.REEF.Bridge.exe";
+  private static final String SECURITY_TOKEN_IDENTIFIER_FILE = 
"SecurityTokenId";
+  private static final String SECURITY_TOKEN_PASSWORD_FILE = 
"SecurityTokenPwd";
 
   @Inject
   public REEFFileNames() {
@@ -216,4 +218,17 @@ public final class REEFFileNames {
     return DRIVER_HTTP_ENDPOINT_FILE_NAME;
   }
 
+  /**
+   * @return File name that contains the security token identifier
+   */
+  public String getSecurityTokenIdentifierFile() {
+    return SECURITY_TOKEN_IDENTIFIER_FILE;
+  }
+
+  /**
+   * @return File name that contains the security token password
+   */
+  public String getSecurityTokenPasswordFile() {
+    return SECURITY_TOKEN_PASSWORD_FILE;
+  }
 }

Reply via email to