| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. See License.txt in the project root for |
| | | 3 | | // license information. |
| | | 4 | | |
| | | 5 | | namespace Microsoft.Azure.HDInsight.Job.Models |
| | | 6 | | { |
| | | 7 | | using System.Collections.Generic; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Parameters specifying the HDInsight MapReduce job definition. |
| | | 11 | | /// </summary> |
| | | 12 | | public partial class MapReduceJobSubmissionParameters |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Optional. Gets the arguments for the jobDetails. |
| | | 16 | | /// </summary> |
| | 24 | 17 | | public IList<string> Arguments { get; set; } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Optional. Gets or sets define parameter list. |
| | | 21 | | /// </summary> |
| | 24 | 22 | | public IDictionary<string, string> Defines { get; set; } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Optional. List of files to be copied to the cluster. |
| | | 26 | | /// </summary> |
| | 0 | 27 | | public IList<string> Files { get; set; } |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Optional. Gets or sets the class. |
| | | 31 | | /// </summary> |
| | 18 | 32 | | public string JarClass { get; set; } |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Optional. Gets or sets the Jar file. |
| | | 36 | | /// </summary> |
| | 18 | 37 | | public string JarFile { get; set; } |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Optional. List of files to include in the classpath. |
| | | 41 | | /// </summary> |
| | 0 | 42 | | public IList<string> LibJars { get; set; } |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Optional. Status directory in the default storage account to store job files stderr, stdout and exit. |
| | | 46 | | /// </summary> |
| | 0 | 47 | | public string StatusDir { get; set; } |
| | | 48 | | |
| | | 49 | | /// <summary> |
| | | 50 | | /// Initializes a new instance of the MapReduceJobSubmissionParameters |
| | | 51 | | /// class. |
| | | 52 | | /// </summary> |
| | 6 | 53 | | public MapReduceJobSubmissionParameters() |
| | | 54 | | { |
| | 6 | 55 | | } |
| | | 56 | | |
| | | 57 | | internal string GetJobPostRequestContent() |
| | | 58 | | { |
| | | 59 | | // Check input parameters and transform them to required format before sending request to templeton. |
| | 6 | 60 | | var values = new List<KeyValuePair<string, string>>(); |
| | | 61 | | |
| | 6 | 62 | | if (!string.IsNullOrEmpty(this.JarFile)) |
| | | 63 | | { |
| | 6 | 64 | | values.Add(new KeyValuePair<string, string>("jar", this.JarFile)); |
| | | 65 | | } |
| | | 66 | | |
| | 6 | 67 | | if (!string.IsNullOrEmpty(this.JarClass)) |
| | | 68 | | { |
| | 6 | 69 | | values.Add(new KeyValuePair<string, string>("class", this.JarClass)); |
| | | 70 | | } |
| | | 71 | | |
| | 6 | 72 | | if (this.Arguments != null && this.Arguments.Count > 0) |
| | | 73 | | { |
| | 6 | 74 | | values.AddRange(ModelHelper.BuildList("arg", this.Arguments)); |
| | | 75 | | } |
| | | 76 | | |
| | 6 | 77 | | if (this.Defines != null && this.Defines.Count > 0) |
| | | 78 | | { |
| | 6 | 79 | | values.AddRange(ModelHelper.BuildNameValueList("define", this.Defines)); |
| | | 80 | | } |
| | | 81 | | |
| | 6 | 82 | | if (this.LibJars != null && this.LibJars.Count > 0) |
| | | 83 | | { |
| | 0 | 84 | | values.Add(new KeyValuePair<string, string>("libjars", ModelHelper.BuildListToCommaSeparatedString(this. |
| | | 85 | | } |
| | | 86 | | |
| | 6 | 87 | | if (this.Files != null && this.Files.Count > 0) |
| | | 88 | | { |
| | 0 | 89 | | values.Add(new KeyValuePair<string, string>("files", ModelHelper.BuildListToCommaSeparatedString(this.Fi |
| | | 90 | | } |
| | | 91 | | |
| | 6 | 92 | | values.Add(new KeyValuePair<string, string>("statusdir", ModelHelper.GetStatusDirectory(this.StatusDir))); |
| | | 93 | | |
| | 6 | 94 | | return ModelHelper.ConvertItemsToString(values); |
| | | 95 | | } |
| | | 96 | | } |
| | | 97 | | } |