Class PipelineJobReporter

java.lang.Object
ubic.gemma.cli.pipeline.PipelineJobReporter

public final class PipelineJobReporter extends Object
Reports CLI progress to the Gemma pipeline framework when this process was launched as a child of a pipeline job. Three environment variables wire the contract:
  • GEMMA_JOB_ID — Gemma-side job id (the PipelineJob.id); enables reporting when present, no-op when absent.
  • GEMMA_PIPELINE_CALLBACK_URL — base URL of gemma-rest's internal callback endpoint (e.g. https://gemma.example.com/rest/v2/internal/pipeline).
  • GEMMA_PIPELINE_CALLBACK_TOKEN — shared bearer secret for the internal endpoint. Resolve from a secrets store before launching the CLI; never bake into a script.

When GEMMA_JOB_ID is unset the reporter is a no-op singleton (NOOP) — standalone CLI invocations remain unaffected.

Failures to reach the callback endpoint are logged at WARN but never propagate — the pipeline framework's reconciler poll loop will eventually close gaps from missed pushes, so a transient network failure shouldn't fail the underlying CLI work.

  • Field Details

  • Method Details

    • fromEnv

      public static PipelineJobReporter fromEnv()
      Resolve a reporter from the process environment. Returns NOOP when GEMMA_JOB_ID is absent — standalone CLI invocations get a no-op reporter without any conditionals at call sites.
    • isActive

      public boolean isActive()
    • stage

      public void stage(String phase)
      Report a stage boundary (e.g. "loading-vectors", "running-anova"). Service-side this transitions QUEUED → RUNNING on first arrival. Non-terminal: fire-and-forget.
    • progress

      public void progress(Integer percent, String message)
      Report a progress sample. percent may be null when the CLI knows step-level progress but not percent-complete. Non-terminal: fire-and-forget.
    • completed

      public void completed()
      Terminal success. Sync-wait so the event reaches the server before the JVM exits. Caller should not emit any further events after this.
    • error

      public void error(Throwable t)
      Terminal failure. Sync-wait so the event reaches the server before the JVM exits. Caller should not emit any further events after this.
    • killed

      public void killed(String reason)
      Terminal cancelled. Sync-wait so the event reaches the server before the JVM exits. Use when the CLI catches an interrupt + wants to report cooperative shutdown.