/** * Returns an object which can be used in a RunJobflow call. * @return an object which can be used in a RunJobflow call. */ public BootstrapActionConfig build() { return new BootstrapActionConfig() .withName("Configure Hadoop") .withScriptBootstrapAction(new ScriptBootstrapActionConfig() .withPath("s3://" + bucket + "/bootstrap-actions/configure-hadoop") .withArgs(args)); } }
/** * <p> * A list of command line arguments to pass to the bootstrap action script. * </p> * * @param args * A list of command line arguments to pass to the bootstrap action script. * @return Returns a reference to this object so that method calls can be chained together. */ public ScriptBootstrapActionConfig withArgs(java.util.Collection<String> args) { setArgs(args); return this; }
/** * Constructs a new ScriptBootstrapActionConfig object. Callers should use the setter or fluent setter (with...) * methods to initialize any additional object members. * * @param path * Location of the script to run during a bootstrap action. Can be either a location in Amazon S3 or on a * local file system. * @param args * A list of command line arguments to pass to the bootstrap action script. */ public ScriptBootstrapActionConfig(String path, java.util.List<String> args) { setPath(path); setArgs(args); }
public ScriptBootstrapActionConfig unmarshall(JsonUnmarshallerContext context) throws Exception { ScriptBootstrapActionConfig scriptBootstrapActionConfig = new ScriptBootstrapActionConfig(); if (context.testExpression("Path", targetDepth)) { context.nextToken(); scriptBootstrapActionConfig.setPath(context.getUnmarshaller(String.class).unmarshall(context)); scriptBootstrapActionConfig.setArgs(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));
/** * Create a new run-if bootstrap action which lets you conditionally run bootstrap actions. * @param condition The condition to evaluate, if true the bootstrap action executes. * @param config The bootstrap action to execute in case of successful evaluation. * @return A BootstrapActionConfig to be provided when running a job flow. */ public BootstrapActionConfig newRunIf(String condition, BootstrapActionConfig config) { List<String> args = config.getScriptBootstrapAction().getArgs(); args.add(0, condition); args.add(1, config.getScriptBootstrapAction().getPath()); return new BootstrapActionConfig() .withName("Run If, " + config.getName()) .withScriptBootstrapAction(new ScriptBootstrapActionConfig() .withPath("s3://" + bucket + "/bootstrap-actions/run-if") .withArgs(args)); }
/** * Create the BootstrapActionConfig object from the bootstrap script. * * @param scriptDescription bootstrap script name to be displayed. * @param bootstrapScript location of the bootstrap script. * * @return bootstrap action configuration that contains all the bootstrap actions for the given configuration. */ private BootstrapActionConfig getBootstrapActionConfig(String scriptDescription, String bootstrapScript) { // Create the BootstrapActionConfig object BootstrapActionConfig bootstrapConfig = new BootstrapActionConfig(); ScriptBootstrapActionConfig bootstrapConfigScript = new ScriptBootstrapActionConfig(); // Set the bootstrapScript bootstrapConfig.setName(scriptDescription); bootstrapConfigScript.setPath(bootstrapScript); bootstrapConfig.setScriptBootstrapAction(bootstrapConfigScript); // Return the object return bootstrapConfig; }
RunJobFlowRequest runJobFlowRequest = new RunJobFlowRequest("Main", jobFlowInstancesConfig) .withName("SDK_filtering" + System.currentTimeMillis()) .withAmiVersion("3.7.0") .withVisibleToAllUsers(true) .withServiceRole("EMR_DefaultRole") .withJobFlowRole("EMR_EC2_DefaultRole") .withBootstrapActions( new BootstrapActionConfig("Install Hue", new ScriptBootstrapActionConfig("s3://us-west-1.elasticmapreduce/libs/hue/install-hue", null))) .withSteps( newEnableDebugStep(), newInstallHiveStep(), newInstallPig(), newRunHueStep() );
/** * <p> * Location of the script to run during a bootstrap action. Can be either a location in Amazon S3 or on a local file * system. * </p> * * @param path * Location of the script to run during a bootstrap action. Can be either a location in Amazon S3 or on a * local file system. * @return Returns a reference to this object so that method calls can be chained together. */ public ScriptBootstrapActionConfig withPath(String path) { setPath(path); return this; }
/** * Configure a bootstrap action object, given its name, path and arguments. * * @param path - path for the bootstrap action program in S3 * @param name - name of the bootstrap action * @param args - arguments for the bootstrap action * @return configuration data object for one bootstrap action */ private static BootstrapActionConfig configureBootstrapAction( String path, String name, List<String> args ) { ScriptBootstrapActionConfig scriptBootstrapActionConfig = new ScriptBootstrapActionConfig(); BootstrapActionConfig bootstrapActionConfig = new BootstrapActionConfig(); scriptBootstrapActionConfig.setPath( path ); scriptBootstrapActionConfig.setArgs( args ); bootstrapActionConfig.setName( name ); bootstrapActionConfig.setScriptBootstrapAction( scriptBootstrapActionConfig ); return bootstrapActionConfig; }
/** * Create a new run-if bootstrap action which lets you conditionally run bootstrap actions. * @param condition The condition to evaluate, if true the bootstrap action executes. * @param config The bootstrap action to execute in case of successful evaluation. * @return A BootstrapActionConfig to be provided when running a job flow. */ public BootstrapActionConfig newRunIf(String condition, BootstrapActionConfig config) { List<String> args = config.getScriptBootstrapAction().getArgs(); args.add(0, condition); args.add(1, config.getScriptBootstrapAction().getPath()); return new BootstrapActionConfig() .withName("Run If, " + config.getName()) .withScriptBootstrapAction(new ScriptBootstrapActionConfig() .withPath("s3://" + bucket + "/bootstrap-actions/run-if") .withArgs(args)); }
/** * Create the BootstrapActionConfig object from the bootstrap script. * * @param scriptDescription bootstrap script name to be displayed. * @param bootstrapScript location of the bootstrap script. * * @return bootstrap action configuration that contains all the bootstrap actions for the given configuration. */ private BootstrapActionConfig getBootstrapActionConfig(String scriptDescription, String bootstrapScript) { // Create the BootstrapActionConfig object BootstrapActionConfig bootstrapConfig = new BootstrapActionConfig(); ScriptBootstrapActionConfig bootstrapConfigScript = new ScriptBootstrapActionConfig(); // Set the bootstrapScript bootstrapConfig.setName(scriptDescription); bootstrapConfigScript.setPath(bootstrapScript); bootstrapConfig.setScriptBootstrapAction(bootstrapConfigScript); // Return the object return bootstrapConfig; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ScriptBootstrapActionConfig == false) return false; ScriptBootstrapActionConfig other = (ScriptBootstrapActionConfig) obj; if (other.getPath() == null ^ this.getPath() == null) return false; if (other.getPath() != null && other.getPath().equals(this.getPath()) == false) return false; if (other.getArgs() == null ^ this.getArgs() == null) return false; if (other.getArgs() != null && other.getArgs().equals(this.getArgs()) == false) return false; return true; }
/** * <p> * Location of the script to run during a bootstrap action. Can be either a location in Amazon S3 or on a local file * system. * </p> * * @param path * Location of the script to run during a bootstrap action. Can be either a location in Amazon S3 or on a * local file system. * @return Returns a reference to this object so that method calls can be chained together. */ public ScriptBootstrapActionConfig withPath(String path) { setPath(path); return this; }
/** * Configure a bootstrap action object, given its name, path and arguments. * * @param path - path for the bootstrap action program in S3 * @param name - name of the bootstrap action * @param args - arguments for the bootstrap action * @return configuration data object for one bootstrap action */ private static BootstrapActionConfig createBootstrapAction( String path, String name, List<String> args ) { ScriptBootstrapActionConfig scriptBootstrapActionConfig = new ScriptBootstrapActionConfig(); BootstrapActionConfig bootstrapActionConfig = new BootstrapActionConfig(); if ( !path.isEmpty() ) { scriptBootstrapActionConfig.setPath( path ); scriptBootstrapActionConfig.setArgs( args ); } bootstrapActionConfig.setName( name ); bootstrapActionConfig.setScriptBootstrapAction( scriptBootstrapActionConfig ); return bootstrapActionConfig; }
/** * Returns an object which can be used in a RunJobflow call. * @return an object which can be used in a RunJobflow call. */ public BootstrapActionConfig build() { if (replace) { args.add("--replace"); } return new BootstrapActionConfig() .withName("Configure Daemons") .withScriptBootstrapAction(new ScriptBootstrapActionConfig() .withPath("s3://" + bucket + "/bootstrap-actions/configure-daemons") .withArgs(args)); } }
/** * <p> * A list of command line arguments to pass to the bootstrap action script. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setArgs(java.util.Collection)} or {@link #withArgs(java.util.Collection)} if you want to override the * existing values. * </p> * * @param args * A list of command line arguments to pass to the bootstrap action script. * @return Returns a reference to this object so that method calls can be chained together. */ public ScriptBootstrapActionConfig withArgs(String... args) { if (this.args == null) { setArgs(new com.amazonaws.internal.SdkInternalList<String>(args.length)); } for (String ele : args) { this.args.add(ele); } return this; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getPath() != null) sb.append("Path: ").append(getPath()).append(","); if (getArgs() != null) sb.append("Args: ").append(getArgs()); sb.append("}"); return sb.toString(); }
/** * Constructs a new ScriptBootstrapActionConfig object. Callers should use the setter or fluent setter (with...) * methods to initialize any additional object members. * * @param path * Location of the script to run during a bootstrap action. Can be either a location in Amazon S3 or on a * local file system. * @param args * A list of command line arguments to pass to the bootstrap action script. */ public ScriptBootstrapActionConfig(String path, java.util.List<String> args) { setPath(path); setArgs(args); }
List<String> args) { ScriptBootstrapActionConfig bootstrapScriptConfig = new ScriptBootstrapActionConfig(); bootstrapScriptConfig.setPath(bootstrapPath); bootstrapScriptConfig.setArgs(args);