UpdateOnlineModelCommand extends AbstractCommand { public static UpdateOnlineModelCommand parse(String cmd, ExecutionContext ctx) throws ODPSConsoleException { if (cmd == null || ctx == null) { return null; } OnlineModelInfo modelInfo = CreateOnlineModelCommand.buildOnlineModelInfo(cmd, PATTERN, ctx); if (modelInfo == null) { return null; } if (modelInfo.project == null) { modelInfo.project = ctx.getProjectName(); } return new UpdateOnlineModelCommand(modelInfo, cmd, ctx); } UpdateOnlineModelCommand(OnlineModelInfo modelInfo, String cmd,
                                  ExecutionContext ctx); static void printUsage(PrintStream stream); @Override void run(); static UpdateOnlineModelCommand parse(String cmd, ExecutionContext ctx); static final String[] HELP_TAGS; }
@Test public void testUpdateOnLineModelWithOfflineModel() throws ODPSConsoleException, OdpsException { ExecutionContext context = ExecutionContext.init(); String cmd = "update onlinemodel -p online_model_test t_offlinemodel " + "-offlinemodelProject online_model_test " + "-offlinemodelName lr_model_for_online " + "-qos 50 " + "-instanceNum 1 " + "-cpu 400 " + "-memory 3"; UpdateOnlineModelCommand command = UpdateOnlineModelCommand.parse(cmd, context); assertNotNull(command); }
@Test public void testUpdateOnLineModelParameterError1() throws ODPSConsoleException, OdpsException { ExecutionContext context = ExecutionContext.init(); String cmd = "update onlinemodel -p prj1 model1 " + "-qos 5000 " + "-instanceNum 2 " + "-cpu 100 " + "-memory 2"; expectEx.expect(ODPSConsoleException.class); expectEx.expectMessage("invalid parameter for onlinemodel, please HELP ONLINEMODEL."); UpdateOnlineModelCommand command = UpdateOnlineModelCommand.parse(cmd, context); }
@Test public void testUpdateOnLineModelParameterError2() throws ODPSConsoleException, OdpsException { ExecutionContext context = ExecutionContext.init(); String cmd = "update onlinemodel -p prj1 model1 " + "-target target1 " + "-libName lib1 " + "-refResource res1 " + "-qos 5000 " + "-instanceNum 2 " + "-cpu 100 " + "-memory 2"; expectEx.expect(ODPSConsoleException.class); expectEx.expectMessage("invalid parameter for onlinemodel, please HELP ONLINEMODEL."); UpdateOnlineModelCommand command = UpdateOnlineModelCommand.parse(cmd, context); }
@Test public void testUpdateOnLineModelParameterError3() throws ODPSConsoleException, OdpsException { ExecutionContext context = ExecutionContext.init(); String cmd = "update onlinemodel -p prj1 model1 " + "-target target1 " + "-id id1 " + "-libName lib1 " + "-refResource res1 " + "-offlinemodelName aaa " + "-instanceNum 2 " + "-cpu 100 " + "-memory 2"; expectEx.expect(ODPSConsoleException.class); expectEx.expectMessage("invalid parameter for onlinemodel, please HELP ONLINEMODEL."); UpdateOnlineModelCommand command = UpdateOnlineModelCommand.parse(cmd, context); }