@Test public void invalidStructureFails() throws Exception { JsonObject argumentsObj = new JsonObject(); argumentsObj.addProperty("namespace", "ns"); argumentsObj.addProperty("name", "app"); argumentsObj.addProperty("artifact", "name-1.0.0"); BootstrapStepResult result = appCreator.execute("label", argumentsObj); Assert.assertEquals(BootstrapStepResult.Status.FAILED, result.getStatus()); } }
@Override public void execute(Arguments arguments) throws Exception { ApplicationId appId = arguments.getId(); ArtifactSummary artifactSummary = arguments.getArtifact(); if (appExists(appId)) { return; } KerberosPrincipalId ownerPrincipalId = arguments.getOwnerPrincipal() == null ? null : new KerberosPrincipalId(arguments.getOwnerPrincipal()); // if we don't null check, it gets serialized to "null" String configString = arguments.getConfig() == null ? null : GSON.toJson(arguments.getConfig()); try { appLifecycleService.deployApp(appId.getParent(), appId.getApplication(), appId.getVersion(), artifactSummary, configString, x -> { }, ownerPrincipalId, arguments.canUpdateSchedules()); } catch (NotFoundException | UnauthorizedException | InvalidArtifactException e) { // these exceptions are for sure not retry-able. It's hard to tell if the others are, so we just try retrying // up to the default time limit throw e; } catch (DatasetManagementException e) { if (e.getCause() instanceof UnauthorizedException) { throw (UnauthorizedException) e.getCause(); } else { throw new RetryableException(e); } } catch (Exception e) { throw new RetryableException(e); } }
@Override public void execute(Arguments arguments) throws Exception { ApplicationId appId = arguments.getId(); ArtifactSummary artifactSummary = arguments.getArtifact(); if (appExists(appId)) { return; } KerberosPrincipalId ownerPrincipalId = arguments.getOwnerPrincipal() == null ? null : new KerberosPrincipalId(arguments.getOwnerPrincipal()); // if we don't null check, it gets serialized to "null" String configString = arguments.getConfig() == null ? null : GSON.toJson(arguments.getConfig()); try { appLifecycleService.deployApp(appId.getParent(), appId.getApplication(), appId.getVersion(), artifactSummary, configString, x -> { }, ownerPrincipalId, arguments.canUpdateSchedules()); } catch (NotFoundException | UnauthorizedException | InvalidArtifactException e) { // these exceptions are for sure not retry-able. It's hard to tell if the others are, so we just try retrying // up to the default time limit throw e; } catch (DatasetManagementException e) { if (e.getCause() instanceof UnauthorizedException) { throw (UnauthorizedException) e.getCause(); } else { throw new RetryableException(e); } } catch (Exception e) { throw new RetryableException(e); } }