Tabnine Logo
WorkflowId.run
Code IndexAdd Tabnine to your IDE (free)

How to use
run
method
in
co.cask.cdap.proto.id.WorkflowId

Best Java code snippets using co.cask.cdap.proto.id.WorkflowId.run (Showing top 20 results out of 315)

origin: cdapio/cdap

@Override
public Map<String, WorkflowNodeStateDetail> getWorkflowNodeStates(String workflowRunId)
 throws NotFoundException {
 try {
  ProgramRunId programRunId = workflowId.run(workflowRunId);
  return workflowClient.getWorkflowNodeStates(programRunId);
 } catch (IOException | UnauthenticatedException | UnauthorizedException e) {
  throw Throwables.propagate(e);
 }
}
origin: cdapio/cdap

@Override
public WorkflowTokenDetail getToken(String runId, @Nullable WorkflowToken.Scope scope,
                  @Nullable String key) throws NotFoundException {
 try {
  return workflowClient.getWorkflowToken(workflowId.run(runId), scope, key);
 } catch (IOException | UnauthenticatedException | UnauthorizedException e) {
  throw Throwables.propagate(e);
 }
}
origin: cdapio/cdap

@Override
public WorkflowTokenNodeDetail getTokenAtNode(String runId, String nodeName, @Nullable WorkflowToken.Scope scope,
                       @Nullable String key) throws NotFoundException {
 try {
  return workflowClient.getWorkflowTokenAtNode(workflowId.run(runId), nodeName, scope, key);
 } catch (IOException | UnauthenticatedException | UnauthorizedException e) {
  throw Throwables.propagate(e);
 }
}
origin: cdapio/cdap

private WorkflowToken getWorkflowToken(String namespaceId, String appName, String workflow,
                    String runId) throws NotFoundException {
 ApplicationId appId = new ApplicationId(namespaceId, appName);
 ApplicationSpecification appSpec = store.getApplication(appId);
 if (appSpec == null) {
  throw new NotFoundException(appId);
 }
 WorkflowId workflowId = appId.workflow(workflow);
 if (!appSpec.getWorkflows().containsKey(workflow)) {
  throw new NotFoundException(workflowId);
 }
 if (store.getRun(workflowId.run(runId)) == null) {
  throw new NotFoundException(workflowId.run(runId));
 }
 return store.getWorkflowToken(workflowId, runId);
}
origin: co.cask.cdap/cdap-app-fabric

private WorkflowToken getWorkflowToken(String namespaceId, String appName, String workflow,
                    String runId) throws NotFoundException {
 ApplicationId appId = new ApplicationId(namespaceId, appName);
 ApplicationSpecification appSpec = store.getApplication(appId);
 if (appSpec == null) {
  throw new NotFoundException(appId);
 }
 WorkflowId workflowId = appId.workflow(workflow);
 if (!appSpec.getWorkflows().containsKey(workflow)) {
  throw new NotFoundException(workflowId);
 }
 if (store.getRun(workflowId.run(runId)) == null) {
  throw new NotFoundException(workflowId.run(runId));
 }
 return store.getWorkflowToken(workflowId, runId);
}
origin: co.cask.cdap/cdap-app-fabric

private void addWorkflowNodeState(ProgramRunId programRunId, Map<String, String> systemArgs,
                 ProgramRunStatus status, @Nullable BasicThrowable failureCause, byte[] sourceId) {
 String workflowNodeId = systemArgs.get(ProgramOptionConstants.WORKFLOW_NODE_ID);
 String workflowName = systemArgs.get(ProgramOptionConstants.WORKFLOW_NAME);
 String workflowRun = systemArgs.get(ProgramOptionConstants.WORKFLOW_RUN_ID);
 ApplicationId appId = programRunId.getParent().getParent();
 ProgramRunId workflowRunId = appId.workflow(workflowName).run(workflowRun);
 // Node states will be stored with following key:
 // workflowNodeState.namespace.app.WORKFLOW.workflowName.workflowRun.workflowNodeId
 MDSKey key = getProgramKeyBuilder(TYPE_WORKFLOW_NODE_STATE, workflowRunId).add(workflowNodeId).build();
 WorkflowNodeStateDetail nodeStateDetail = new WorkflowNodeStateDetail(workflowNodeId,
                                    ProgramRunStatus.toNodeStatus(status),
                                    programRunId.getRun(), failureCause);
 write(key, nodeStateDetail);
 // Get the run record of the Workflow which started this program
 key = getProgramRunInvertedTimeKey(TYPE_RUN_RECORD_ACTIVE, workflowRunId,
                   RunIds.getTime(workflowRun, TimeUnit.SECONDS));
 RunRecordMeta record = get(key, RunRecordMeta.class);
 if (record != null) {
  // Update the parent Workflow run record by adding node id and program run id in the properties
  Map<String, String> properties = new HashMap<>(record.getProperties());
  properties.put(workflowNodeId, programRunId.getRun());
  write(key, RunRecordMeta.builder(record).setProperties(properties).setSourceId(sourceId).build());
 }
}
origin: cdapio/cdap

private void addWorkflowNodeState(ProgramRunId programRunId, Map<String, String> systemArgs,
                 ProgramRunStatus status, @Nullable BasicThrowable failureCause, byte[] sourceId) {
 String workflowNodeId = systemArgs.get(ProgramOptionConstants.WORKFLOW_NODE_ID);
 String workflowName = systemArgs.get(ProgramOptionConstants.WORKFLOW_NAME);
 String workflowRun = systemArgs.get(ProgramOptionConstants.WORKFLOW_RUN_ID);
 ApplicationId appId = programRunId.getParent().getParent();
 ProgramRunId workflowRunId = appId.workflow(workflowName).run(workflowRun);
 // Node states will be stored with following key:
 // workflowNodeState.namespace.app.WORKFLOW.workflowName.workflowRun.workflowNodeId
 MDSKey key = getProgramKeyBuilder(TYPE_WORKFLOW_NODE_STATE, workflowRunId).add(workflowNodeId).build();
 WorkflowNodeStateDetail nodeStateDetail = new WorkflowNodeStateDetail(workflowNodeId,
                                    ProgramRunStatus.toNodeStatus(status),
                                    programRunId.getRun(), failureCause);
 write(key, nodeStateDetail);
 // Get the run record of the Workflow which started this program
 key = getProgramRunInvertedTimeKey(TYPE_RUN_RECORD_ACTIVE, workflowRunId,
                   RunIds.getTime(workflowRun, TimeUnit.SECONDS));
 RunRecordMeta record = get(key, RunRecordMeta.class);
 if (record != null) {
  // Update the parent Workflow run record by adding node id and program run id in the properties
  Map<String, String> properties = new HashMap<>(record.getProperties());
  properties.put(workflowNodeId, programRunId.getRun());
  write(key, RunRecordMeta.builder(record).setProperties(properties).setSourceId(sourceId).build());
 }
}
origin: caskdata/cdap

@Override
public void perform(Arguments arguments, PrintStream printStream) throws Exception {
 String[] programIdParts = arguments.get(elementType.getArgumentName().toString()).split("\\.");
 if (programIdParts.length < 2) {
  throw new CommandInputError(this);
 }
 ProgramRunId programRunId = cliConfig.getCurrentNamespace().app(programIdParts[0]).workflow(programIdParts[1])
  .run(arguments.get(ArgumentName.RUN_ID.toString()));
 Table table = getWorkflowNodeStates(programRunId);
 cliConfig.getTableRenderer().render(cliConfig, printStream, table);
}
origin: caskdata/cdap

@Override
public void perform(Arguments arguments, PrintStream printStream) throws Exception {
 String[] programIdParts = arguments.get(elementType.getArgumentName().toString()).split("\\.");
 if (programIdParts.length < 2) {
  throw new CommandInputError(this);
 }
 ProgramRunId programRunId = cliConfig.getCurrentNamespace().app(programIdParts[0]).workflow(programIdParts[1])
  .run(arguments.get(ArgumentName.RUN_ID.toString()));
 Table table = getWorkflowLocalDatasets(programRunId);
 cliConfig.getTableRenderer().render(cliConfig, printStream, table);
}
origin: co.cask.cdap/cdap-cli

@Override
public void perform(Arguments arguments, PrintStream printStream) throws Exception {
 String[] programIdParts = arguments.get(elementType.getArgumentName().toString()).split("\\.");
 if (programIdParts.length < 2) {
  throw new CommandInputError(this);
 }
 ProgramRunId programRunId = cliConfig.getCurrentNamespace().app(programIdParts[0]).workflow(programIdParts[1])
  .run(arguments.get(ArgumentName.RUN_ID.toString()));
 Table table = getWorkflowLocalDatasets(programRunId);
 cliConfig.getTableRenderer().render(cliConfig, printStream, table);
}
origin: co.cask.cdap/cdap-cli

@Override
public void perform(Arguments arguments, PrintStream printStream) throws Exception {
 String[] programIdParts = arguments.get(elementType.getArgumentName().toString()).split("\\.");
 if (programIdParts.length < 2) {
  throw new CommandInputError(this);
 }
 ProgramRunId programRunId = cliConfig.getCurrentNamespace().app(programIdParts[0]).workflow(programIdParts[1])
  .run(arguments.get(ArgumentName.RUN_ID.toString()));
 Table table = getWorkflowNodeStates(programRunId);
 cliConfig.getTableRenderer().render(cliConfig, printStream, table);
}
origin: cdapio/cdap

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);
}
origin: cdapio/cdap

@Test
public void testWorkflow() throws InterruptedException, ExecutionException, TimeoutException {
 ProgramRunId workflowRunId = workflow1.run(RunIds.generate());
origin: cdapio/cdap

@Test
public void testRoundingLogic() throws Exception {
 ProgramRunId runId = NamespaceId.DEFAULT.app("round").workflow("round").run(RunIds.generate());
 ProfileId profileId = NamespaceId.DEFAULT.profile("roundProfile");
 MetricsCollectionService collectionService = injector.getInstance(MetricsCollectionService.class);
origin: cdapio/cdap

@Test
public void testProfileMetrics() throws Exception {
 ProgramRunId runId = NamespaceId.DEFAULT.app("myApp").workflow("myProgram").run(RunIds.generate());
 ProfileId profileId = NamespaceId.DEFAULT.profile("myProfile");
 MetricsCollectionService collectionService = injector.getInstance(MetricsCollectionService.class);
 MetricStore metricStore = injector.getInstance(MetricStore.class);
 // There are 5 nodes, we emit the metrics each 2 mins, so each time the node minute should go up by 10 min
 ProfileMetricService scheduledService = new ProfileMetricService(collectionService, runId, profileId, 5, 2, null);
 // emit and verify the results
 scheduledService.emitMetric();
 Tasks.waitFor(10L, () -> getMetric(metricStore, runId, profileId,
                  "system." + Constants.Metrics.Program.PROGRAM_NODE_MINUTES),
        10, TimeUnit.SECONDS);
 scheduledService.emitMetric();
 Tasks.waitFor(20L, () -> getMetric(metricStore, runId, profileId,
                  "system." + Constants.Metrics.Program.PROGRAM_NODE_MINUTES),
        10, TimeUnit.SECONDS);
 scheduledService.emitMetric();
 Tasks.waitFor(30L, () -> getMetric(metricStore, runId, profileId,
                  "system." + Constants.Metrics.Program.PROGRAM_NODE_MINUTES),
        10, TimeUnit.SECONDS);
}
origin: cdapio/cdap

ProgramRunId pid1 = WORKFLOW_ID.run(RunIds.generate().getId());
ProgramRunId pid2 = WORKFLOW_ID.run(RunIds.generate().getId());
ProgramRunId pid3 = WORKFLOW_ID.run(RunIds.generate().getId());
origin: cdapio/cdap

@Test
public void testProfileMetricsDeletion() throws Exception {
 ProfileId myProfile = NamespaceId.DEFAULT.profile("MyProfile");
 Profile profile = new Profile("MyProfile", Profile.NATIVE.getLabel(), Profile.NATIVE.getDescription(),
                Profile.NATIVE.getScope(), Profile.NATIVE.getProvisioner());
 ProgramRunId runId = NamespaceId.DEFAULT.app("myApp").workflow("myProgram").run(RunIds.generate());
 // create and disable the profile
 profileService.saveProfile(myProfile, profile);
 profileService.disableProfile(myProfile);
 // emit some metrics
 MetricsCollectionService metricService = injector.getInstance(MetricsCollectionService.class);
 MetricsContext metricsContext = metricService.getContext(getMetricsTags(runId, myProfile));
 metricsContext.increment(Constants.Metrics.Program.PROGRAM_NODE_MINUTES, 30L);
 MetricStore metricStore = injector.getInstance(MetricStore.class);
 Tasks.waitFor(30L, () -> getMetric(metricStore, runId, myProfile,
                  "system." + Constants.Metrics.Program.PROGRAM_NODE_MINUTES),
        10, TimeUnit.SECONDS);
 // delete and verify the metrics are gone
 profileService.deleteProfile(myProfile);
 Tasks.waitFor(0L, () -> getMetric(metricStore, runId, myProfile,
                   "system." + Constants.Metrics.Program.PROGRAM_NODE_MINUTES),
        10, TimeUnit.SECONDS);
}
origin: cdapio/cdap

ProgramRunId programRunId = NamespaceId.DEFAULT.app("app1").workflow("testkill").run(runId);
ProfileId profileId = NamespaceId.DEFAULT.profile("myProfile");
publishProgramStatus(programRunId, ProgramStatus.INITIALIZING);
origin: cdapio/cdap

@Test
public void testProfileInRunRecord() throws Exception {
 AppMetadataStore store = getMetadataStore("testProfileInRunRecord");
 TransactionExecutor txnl = getTxExecutor(store);
 ProgramRunId runId = NamespaceId.DEFAULT.app("myApp").workflow("myProgram").run(RunIds.generate());
 ProfileId profileId = NamespaceId.DEFAULT.profile("MyProfile");
 txnl.execute(() -> {
  long startSourceId = 1L;
  store.recordProgramProvisioning(runId, null,
                  Collections.singletonMap(SystemArguments.PROFILE_NAME, profileId.getScopedName()),
                  AppFabricTestHelper.createSourceId(startSourceId), ARTIFACT_ID);
  // the profile id should be there after the provisioning stage
  RunRecordMeta run = store.getRun(runId);
  Assert.assertNotNull(run);
  Assert.assertEquals(profileId, run.getProfileId());
  store.recordProgramProvisioned(runId, 0, AppFabricTestHelper.createSourceId(startSourceId + 1));
  store.recordProgramStart(runId, null, ImmutableMap.of(),
               AppFabricTestHelper.createSourceId(startSourceId + 2));
  store.recordProgramRunning(runId, RunIds.getTime(runId.getRun(), TimeUnit.SECONDS),
                null, AppFabricTestHelper.createSourceId(startSourceId + 3));
  store.recordProgramStop(runId, RunIds.getTime(runId.getRun(), TimeUnit.SECONDS),
              ProgramRunStatus.KILLED,
              null, AppFabricTestHelper.createSourceId(startSourceId + 4));
  run = store.getRun(runId);
  Assert.assertNotNull(run);
  Assert.assertEquals(profileId, run.getProfileId());
 });
}
origin: cdapio/cdap

ProgramRunId programRunId = NamespaceId.DEFAULT.app("app1").workflow("myworkflow").run(runId);
ProfileId profileId = NamespaceId.DEFAULT.profile("myProfile");
publishProgramStatus(programRunId, ProgramStatus.INITIALIZING);
co.cask.cdap.proto.idWorkflowIdrun

Popular methods of WorkflowId

  • getProgram
  • <init>
  • getApplication
  • getParent
  • toMetadataEntity
  • getNamespace
  • getNamespaceId
  • getVersion

Popular in Java

  • Reactive rest calls using spring rest template
  • getExternalFilesDir (Context)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now