true, the bootstrap action executes. * @param array $args (Optional) An indexed array of arguments to pass to the script. * @return array A configuration set to be provided when running a job flow. */ public static function run_if($condition, $args = null) { if (!$args) $args = array(); $args = is_array($args) ? $args : array($args); return self::script_runner('s3://us-east-1.elasticmapreduce/bootstrap-actions/run-if', $args); } /** * Specify options to merge with Hadoop's default configuration. * * @param string $file (Required) The Hadoop configuration file to merge with. [Allowed values: CFHadoopBootstrap::CONFIG_SITE, CFHadoopBootstrap::CONFIG_DEFAULT, CFHadoopBootstrap::CONFIG_CORE, CFHadoopBootstrap::CONFIG_HDFS, CFHadoopBootstrap::CONFIG_MAPREDUCE] * @param string|array $config (Required) This can either be an XML file in S3 (as s3://bucket/path), or an associative array of key-value pairs. * @return array A configuration set to be provided when running a job flow. */ public static function configure($file, $config) { $args = array(); $file_arg = '-' . $file; if (is_string($config)) { $args[] = $file_arg; $args[] = $config; } elseif (is_array($config)) { foreach ($config as $key => $value) { $args[] = $file_arg; $args[] = $key . '=' . $value; } } return self::script_runner('s3://us-east-1.elasticmapreduce/bootstrap-actions/configure-hadoop', $args); } /** * Create a new bootstrap action which lets you configure Hadoop's daemons. The options are written to * the hadoop-user-env.sh file. * * @param string $daemon_type (Required) The Hadoop daemon to configure. * @param array $opt (Optional) An associative array of parameters that can have the following keys: * @return array A configuration set to be provided when running a job flow. */ public static function daemon($daemon_type, $opt = null) { if (!$opt) $opt = array(); $args = array(); foreach ($opt as $key => $value) { switch ($key) { case 'HeapSize': $args[] = '--' . $daemon_type . '-heap-size=' . $value; break; case 'CLIOptions': $args[] = '--' . $daemon_type . '-opts="' . $value . '"'; break; case 'Replace': if ((is_string($value) && $value === 'true') || (is_bool($value) && $value === true)) { $args[] = '--replace'; } break; } } return self::script_runner('s3://us-east-1.elasticmapreduce/bootstrap-actions/configure-daemons', $args); } }