Permalink
Browse files

Add support to KittenClient for using the new local resources option

  • Loading branch information...
jwills committed Jun 30, 2012
1 parent 662179b commit 7ba2c2dbd32e51389092dfa6843c5e6b583e2ca1
@@ -37,13 +37,19 @@
private static final Log LOG = LogFactory.getLog(KittenClient.class);
private Map<String, Object> extraLuaValues;
+ private Map<String, String> extraLocalResources;
public KittenClient() {
this(ImmutableMap.<String, Object>of());
}
public KittenClient(Map<String, Object> extraLuaValues) {
+ this(extraLuaValues, ImmutableMap.<String, String>of());
+ }
+
+ public KittenClient(Map<String, Object> extraLuaValues, Map<String, String> extraLocalResources) {
this.extraLuaValues = extraLuaValues;
+ this.extraLocalResources = extraLocalResources;
}
@Override
@@ -55,7 +61,7 @@ public int run(String[] args) throws Exception {
Configuration conf = getConf();
YarnClientParameters params = new LuaYarnClientParameters(args[0], args[1], conf,
- extraLuaValues);
+ extraLuaValues, extraLocalResources);
YarnClientService service = new YarnClientServiceImpl(params);
return handle(service);
@@ -48,11 +48,17 @@ public LuaYarnClientParameters(String script, String jobName, Configuration conf
public LuaYarnClientParameters(String script, String jobName, Configuration conf,
Map<String, Object> extraLuaValues) {
+ this(script, jobName, conf, extraLuaValues, ImmutableMap.<String, String>of());
+ }
+
+ public LuaYarnClientParameters(String script, String jobName, Configuration conf,
+ Map<String, Object> extraLuaValues, Map<String, String> resources) {
this.env = new LuaWrapper(script, extraLuaValues).getTable(jobName);
this.conf = initConf(env, conf);
this.extras = new Extras();
this.extras.putEnv(LuaFields.KITTEN_JOB_NAME, jobName);
this.extras.putResource(LuaFields.KITTEN_LUA_CONFIG_FILE, script);
+ this.extras.putAllResources(resources);
if (extraLuaValues != null && !extraLuaValues.isEmpty()) {
this.extras.putEnv(LuaFields.KITTEN_EXTRA_LUA_VALUES,
LocalDataHelper.serialize(extraLuaValues));

0 comments on commit 7ba2c2d

Please sign in to comment.