Skip to content

Add optional periodic CLI execution progress #74

Closed

Description

@ejboy

Long-running ETL jobs need simple periodic CLI feedback without verbose logging, JMX, or waiting until completion. This applies to any Scriptella ETL execution, independently of migrations.

Target: Scriptella 1.7.0.

CLI

scriptella --progress import.etl.xml
scriptella --progress=10s import.etl.xml
scriptella --progress=2m import.etl.xml
  • Bare --progress enables a default interval of 30 seconds.
  • Overrides accept positive whole-number durations with s for seconds or m for minutes. Minimum: 1 second.
  • Reject empty overrides (--progress=), missing suffixes, malformed/fractional values, zero, negative and sub-second durations, and numeric/scheduler overflow with clear diagnostics. Bare --progress is valid; overrides use the equals form.
  • No new configuration files or XML settings. Preserve existing CLI behavior when disabled.

Output

Approximately every configured interval, print to stderr:

[00:30] 185,000 statements | 6,167/s
[01:00] 371,000 statements | 6,183/s

Show monotonic elapsed execution time, cumulative executed statement count, and average statements per second since that execution started. No percentage. Reset timing/counts for each ETL file and identify the active file for multi-file invocations. Short jobs may finish before the first periodic line; existing completion/error output remains authoritative.

Use existing Scriptella statement-counter semantics:

  • JDBC updates may be counted after submission to a batch, before flushing.
  • Query statements are counted after callback processing completes; a long in-flight statement can leave the count unchanged while elapsed time advances.
  • Counts are not migrated rows, server-confirmed executions, or committed transactions.
  • Report unavailable counters explicitly and identify mixed coverage as partial. Do not infer availability from numeric zero or make unsupported drivers appear idle. Avoid breaking third-party SPI implementations solely for this feature.

Proposed CLI interaction: an explicit progress request remains active with --quiet and --no-stat. Quiet suppresses incidental logs; no-stat suppresses detailed aggregation, not explicitly requested lightweight progress. --no-jmx must not disable progress. Document and test these rules; keep stdout separate.

Implementation direction and feasibility

Configurable 10s/2m intervals require a small bounded parser and scheduler setting, not a new reporting model. Safe live snapshots and reporter lifecycle are the substantive work.

Reuse existing facilities where practical:

  • tools/src/java/scriptella/tools/launcher/EtlLauncher.java: CLI, per-file execution and monotonic failure timing.
  • core/src/java/scriptella/spi/AbstractConnection.java: StatementCounter.statements is already volatile.
  • core/src/java/scriptella/core/Session.java and ConnectionManager.java: live aggregation, with mutable connection collections/cleanup requiring safe access.
  • core/src/java/scriptella/execution/JmxEtlManager.java: existing count/throughput precedent.
  • ExecutionStatisticsBuilder is not thread safe and completed-element aggregation is insufficient for long-running queries.
  • Existing ConsoleProgressIndicator phase/element percentages are distinct from periodic throughput.

Use narrow thread-safe snapshots or safely published counter handles with explicit ownership/lifetime. Volatile counters do not make connection registration, iteration and teardown safe. The reporting thread must not access JDBC connections or invoke arbitrary driver callbacks whose thread safety is unknown. Preserve totals when connections retire, avoid nested-query double counting, and avoid locking across database work or waiting for a statement to finish merely to print elapsed time.

Stop the reporter cleanly on success, failure and cooperative cancellation. Avoid teardown races, thread leaks and masking the original result. Keep disabled overhead negligible.

Do not introduce per-row logging, global JMX MBean polling, a JMX requirement, a new monitoring subsystem, expensive event collection, or new row/batch instrumentation from #73.

Acceptance criteria

  • Default 30-second and explicit intervals work, including 10s, 2m and the documented minimum.
  • Invalid/missing override values, excessively small intervals and overflow fail clearly.
  • Existing CLI invocation remains compatible; no periodic output or reporter when disabled.
  • Counts and elapsed/average-throughput calculations match documented existing semantics.
  • Reporter terminates on success, failure and cancellation without concurrent modification, lifecycle races, deadlocks or leaks.
  • Cover nested queries, batching/final partial batches, lazy/new-transaction connections, multiple ETL files, unavailable/mixed counters, and a long in-flight statement.
  • Define and test quiet/no-stat/no-JMX interactions; output goes to stderr.
  • Document the option, duration bounds, counter limitations and multi-file behavior in CLI help and usage documentation.
  • Prefer controllable clock/scheduler tests over 30-second sleeps; avoid broad new runtime instrumentation.

Relationship to existing issues

This feature is independently deliverable. It may share lightweight timing/snapshot groundwork with #73 but must not depend on completion of JSON reporting or duplicate its richer metrics work.

Activity

  1. added this to the 1.7.0 milestone on Oct 21, 2026
  2. ejboy commented on Oct 25, 2026

    @ejboy
    MemberAuthor

    Implemented and validated in fed3f65 for the upcoming 1.7.0 release; not yet released.

    Includes interval parsing, safe live counter snapshots, per-file stderr reporting, documented counter availability/semantics, CLI option interactions and reporter cleanup. Tests cover interval bounds, formatting, controllable scheduling, nested queries/batching/lazy and new-transaction connections, multiple files, unsupported counters, failure and cooperative cancellation.

    CI passed Maven tests and Ant package contracts on Java 17 and 25, plus PostgreSQL, MariaDB, SQL Server and Oracle compatibility checks: https://github.com/scriptella/scriptella-etl/actions/runs/39659867071 (package/test checks), https://github.com/scriptella/scriptella-etl/actions/runs/39659866861 (database checks).

    Release notes, published CLI documentation, statement-counter caveats, the duration FAQ and final release validation remain tracked in #70. Closing as completed; retaining the 1.7.0 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions