Map<String, Plugin> plugins = deserializeMap(jsonObj.get("plugins"), context, Plugin.class); return new DefaultApplicationSpecification(name, appVersion, description, configuration, artifactId, datasetModules, datasetInstances, mapReduces, sparks,
Map<String, Plugin> plugins = deserializeMap(jsonObj.get("plugins"), context, Plugin.class); return new DefaultApplicationSpecification(name, appVersion, description, configuration, artifactId, streams, datasetModules, datasetInstances, flows, mapReduces, sparks,
public ApplicationSpecification createSpecification(@Nullable String applicationName, @Nullable String applicationVersion) { // applicationName can be null only for apps before 3.2 that were not upgraded ArtifactScope scope = artifactId.getNamespace().equals(Id.Namespace.SYSTEM) ? ArtifactScope.SYSTEM : ArtifactScope.USER; ArtifactId artifactId = new ArtifactId(this.artifactId.getName(), this.artifactId.getVersion(), scope); String namespace = deployNamespace.toEntityId().getNamespace(); String appName = applicationName == null ? name : applicationName; String appVersion = applicationVersion == null ? ApplicationId.DEFAULT_VERSION : applicationVersion; Map<String, ScheduleCreationSpec> builtScheduleSpecs = new HashMap<>(); for (Map.Entry<String, ScheduleCreationSpec> entry : scheduleSpecs.entrySet()) { // If the ScheduleCreationSpec is really a builder, then build the ScheduleCreationSpec if (entry.getValue() instanceof DefaultScheduleBuilder.ScheduleCreationBuilder) { DefaultScheduleBuilder.ScheduleCreationBuilder builder = (DefaultScheduleBuilder.ScheduleCreationBuilder) entry.getValue(); builtScheduleSpecs.put(entry.getKey(), builder.build(namespace, appName, appVersion)); } else { builtScheduleSpecs.put(entry.getKey(), entry.getValue()); } } return new DefaultApplicationSpecification(appName, appVersion, description, configuration, artifactId, getDatasetModules(), getDatasetSpecs(), mapReduces, sparks, workflows, services, builtScheduleSpecs, workers, getPlugins()); }
public ApplicationSpecification createSpecification(@Nullable String applicationName, @Nullable String applicationVersion) { // applicationName can be null only for apps before 3.2 that were not upgraded ArtifactScope scope = artifactId.getNamespace().equals(Id.Namespace.SYSTEM) ? ArtifactScope.SYSTEM : ArtifactScope.USER; ArtifactId artifactId = new ArtifactId(this.artifactId.getName(), this.artifactId.getVersion(), scope); String namespace = deployNamespace.toEntityId().getNamespace(); String appName = applicationName == null ? name : applicationName; String appVersion = applicationVersion == null ? ApplicationId.DEFAULT_VERSION : applicationVersion; Map<String, ScheduleCreationSpec> builtScheduleSpecs = new HashMap<>(); for (Map.Entry<String, ScheduleCreationSpec> entry : scheduleSpecs.entrySet()) { // If the ScheduleCreationSpec is really a builder, then build the ScheduleCreationSpec if (entry.getValue() instanceof DefaultScheduleBuilder.ScheduleCreationBuilder) { DefaultScheduleBuilder.ScheduleCreationBuilder builder = (DefaultScheduleBuilder.ScheduleCreationBuilder) entry.getValue(); builtScheduleSpecs.put(entry.getKey(), builder.build(namespace, appName, appVersion)); } else { builtScheduleSpecs.put(entry.getKey(), entry.getValue()); } } return new DefaultApplicationSpecification(appName, appVersion, description, configuration, artifactId, getStreams(), getDatasetModules(), getDatasetSpecs(), flows, mapReduces, sparks, workflows, services, builtScheduleSpecs, workers, getPlugins()); }
Collections.emptyMap()); ApplicationSpecification dummyAppSpec1 = new DefaultApplicationSpecification(APP1_ID.getApplication(), "dummy app", null, ARTIFACT_ID1.toApiArtifactId(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap()); ApplicationSpecification dummyAppSpec2 = new DefaultApplicationSpecification(APP2_ID.getApplication(), "dummy app", null, ARTIFACT_ID2.toApiArtifactId(), Collections.emptyMap(), Collections.emptyMap(),
@Test public void testManyMacrosInAppSpec() { Configuration hConf = new Configuration(); MapReduceContextConfig cfg = new MapReduceContextConfig(hConf); StringBuilder appCfg = new StringBuilder(); for (int i = 0; i < 100; i++) { appCfg.append("${").append(i).append("}"); hConf.setInt(String.valueOf(i), i); } ApplicationSpecification appSpec = new DefaultApplicationSpecification( "name", "desc", appCfg.toString(), new ArtifactId("artifact", new ArtifactVersion("1.0.0"), ArtifactScope.USER), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap() ); cfg.setApplicationSpecification(appSpec); Assert.assertEquals(appSpec.getConfiguration(), cfg.getApplicationSpecification().getConfiguration()); }
private TaskFields createTaskInfo(ProvisionerInfo provisionerInfo) { ProgramRunId programRunId = NamespaceId.DEFAULT.app("app").workflow("wf").run(RunIds.generate()); Map<String, String> systemArgs = new HashMap<>(); Map<String, String> userArgs = new HashMap<>(); Profile profile = new Profile(ProfileId.NATIVE.getProfile(), "label", "desc", provisionerInfo); SystemArguments.addProfileArgs(systemArgs, profile); ProgramOptions programOptions = new SimpleProgramOptions(programRunId.getParent(), new BasicArguments(systemArgs), new BasicArguments(userArgs)); ArtifactId artifactId = NamespaceId.DEFAULT.artifact("testArtifact", "1.0").toApiArtifactId(); ApplicationSpecification appSpec = new DefaultApplicationSpecification( "name", "1.0.0", "desc", null, artifactId, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap()); ProgramDescriptor programDescriptor = new ProgramDescriptor(programRunId.getParent(), appSpec); return new TaskFields(programDescriptor, programOptions, programRunId); }
@Test public void testAppSpecNotRequiredToWriteState() throws Exception { ProgramId programId = NamespaceId.DEFAULT.app("someapp").program(ProgramType.SERVICE, "s"); Map<String, String> systemArguments = new HashMap<>(); systemArguments.put(ProgramOptionConstants.SKIP_PROVISIONING, Boolean.TRUE.toString()); systemArguments.put(SystemArguments.PROFILE_NAME, ProfileId.NATIVE.getScopedName()); ProgramOptions programOptions = new SimpleProgramOptions(programId, new BasicArguments(systemArguments), new BasicArguments()); ProgramRunId runId = programId.run(RunIds.generate()); ArtifactId artifactId = NamespaceId.DEFAULT.artifact("testArtifact", "1.0").toApiArtifactId(); ApplicationSpecification appSpec = new DefaultApplicationSpecification( "name", "1.0.0", "desc", null, artifactId, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap()); ProgramDescriptor programDescriptor = new ProgramDescriptor(programId, appSpec); programStateWriter.start(runId, programOptions, null, programDescriptor); Tasks.waitFor(ProgramRunStatus.STARTING, () -> txnl.execute(() -> { RunRecordMeta meta = metadataStoreDataset.getRun(runId); if (meta == null) { return null; } Assert.assertEquals(artifactId, meta.getArtifactId()); return meta.getStatus(); }), 10, TimeUnit.SECONDS); programStateWriter.completed(runId); }
ApplicationSpecification appSpec = new DefaultApplicationSpecification( AppWithMultipleSchedules.NAME, ApplicationId.DEFAULT_VERSION, "desc", null, artifactId, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(),
ApplicationSpecification appSpec = new DefaultApplicationSpecification( "name", "1.0.0", "desc", null, artifactId, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(),
ArtifactId artifactId = NamespaceId.DEFAULT.artifact("testArtifact", "1.0").toApiArtifactId(); ApplicationSpecification appSpec = new DefaultApplicationSpecification( "name", "1.0.0", "desc", null, artifactId, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(),