Skip to content

v1.14.0

Latest

Choose a tag to compare

@kitagry kitagry released this 25 Nov 12:23
· 11 commits to master since this release
0fa5992

⚠️ Breaking changes

  • redis is no longer installed by default (#642, @hirosassa). It moved to the optional extra gokart[redis]. If you use the Redis lock ([gokart_lock] url=redis://..., the deprecated redis_host / redis_port, or should_lock_run), install gokart[redis] (or gokart[all]). Without it, a task that is configured for a Redis lock raises ImportError with the install hint when it is created (#650, @kitagry).
  • pandas>=3 is required (#623, @hirosassa). pandas 2 is no longer supported. Upgrade pandas to 3.x (see the pandas 3.0 migration guide); Copy-on-Write is always on.
  • gokart.build raises GokartBuildError when the build ends as MISSING_EXT or NOT_RUN (#684, @hirosassa). These used to be treated as success, so a build whose ExternalTask output was missing returned normally even though the requested task never ran. Now every status other than SUCCESS / SUCCESS_WITH_RETRY raises. Make sure external dependencies exist before building, or catch GokartBuildError where you relied on the old behavior. The new GokartBuildError.status (a luigi.LuigiStatusCode) tells MISSING_EXT / NOT_RUN apart from a failed task; raised_exceptions is empty for them.

Other behavior changes worth checking

  • Tasks with should_lock_run=True take the run lock in the gokart worker (gokart.build / gokart.run). Under plain luigi.build or the luigi CLI, no run lock is taken; dump() falls back to the dump lock and emits a UserWarning (#605, @kitagry).
  • The completion check just before run() is done only by the gokart worker. gokart/task_complete_check.py is removed, and --test-run-pandas now really runs every task's run() (with dump patched out), so it may be slower or report failures it never exercised before (#608, @kitagry).
  • GCS goes through google-cloud-storage (#635, #637, #640, @kitagry): GCS I/O errors are google.api_core.exceptions.* instead of googleapiclient.errors.HttpError, last_modification_time() of a gs:// target returns a timezone-aware datetime, labels are attached in the upload request, and the internal module gokart.gcs_obj_metadata_client is removed. The gcs extra now installs google-cloud-storage>=2.
  • The s3 extra requires botocore>=1.35.69 (#649, @hirosassa).
  • .pkl outputs are written with pickle protocol 5, so the bytes differ (files of earlier versions load as before; task ids do not change). An OSError while pickling no longer falls back to dill (#688, @kitagry).
  • LargeDataFrameProcessor(max_byte=...) raises ValueError for max_byte <= 0 (#644, @hirosassa), and DataFrames with object or mixed dtypes may be split into more chunks (#668, @hirosassa).
  • fail_on_empty_dump=True also rejects an empty polars.DataFrame (#672, @kitagry).
  • delete_local_unnecessary_outputs logs absolute, resolved paths (#671, @kitagry).

Deprecations

Every deprecated API is removed in gokart 2.0.0 (tracked in #685), and they now warn with FutureWarning, which is shown by default (#689, @kitagry). If you filter these warnings, or assert them with pytest.warns(DeprecationWarning), switch to FutureWarning.

Deprecated Use instead
TaskOnKart.redis_host / redis_port / redis_timeout (#646, @hirosassa) url and timeout of the new [gokart_lock] section
GCSConfig.get_gcs_client() and google-api-python-client in the gcs extra (#637, @kitagry) GCSConfig.get_storage_client() (google.cloud.storage.Client)
make_large_data_frame_target / LargeDataFrameProcessor (#680, @kitagry) a single pickle target, self.make_target('data.pkl')
JsonFileProcessor(orient='records') writing NDJSON (#459, @kitagry) NdjsonFileProcessor / the .ndjson extension (in 2.0.0, orient='records' writes a JSON array)
wrap_run_with_lock (#605, @kitagry) gokart.build / gokart.run, whose worker takes the run lock
gokart.slack Luigi event handlers (e.g. @luigi.Task.event_handler)
The gokart mypy plugin (still DeprecationWarning, which mypy does not show by default) parameter type annotations, e.g. foo: luigi.IntParameter = luigi.IntParameter()

pandas will also become optional in 2.0.0 (#674). If you use pandas with gokart, depend on gokart[pandas] now (#675, @kitagry).

New features

  • [gokart_lock] config for the lock backend: url=redis[s]://host[:port][/db], timeout, password from GOKART_REDIS_PASSWORD (#646, @hirosassa).
  • Run lock on object storage: [gokart_lock] url=gs://bucket[/prefix] (#647, @hirosassa) or s3://bucket[/prefix], with S3Config.endpoint_url for S3-compatible stores (#649, @hirosassa). Only the run lock is taken there; dump / load / remove locks still need Redis.
  • In-memory outputs: self.make_target('x.pkl', persist=False) keeps an output in memory for one gokart.build, released as soon as no task needs it (#639, #655, #657, @kitagry).
  • NdjsonFileProcessor for newline-delimited JSON (.ndjson) (#459, @kitagry).
  • gokart[pandas] extra (pandas>=3, pyarrow), included in gokart[all] (#675, @kitagry).
  • Parallel upload / download of large GCS objects with [GCSConfig] parallel_upload_threshold / parallel_download_threshold (opt-in; the gcs extra requires google-cloud-storage>=2.18.2) (#687, @kitagry).

Performance

  • import gokart no longer imports pandas or polars until they are used: 340 ms → about 150 ms (#666, #675, @kitagry).
  • .pkl dumps stream to the file with pickle protocol 5: about 4x faster, with much lower peak memory for large DataFrames (#688, @kitagry).
  • Fewer remote exists() calls: complete() short-circuits and memoizes shared dependencies (#624, #669, @hirosassa), and make_task_info_tree checks each task once (#616, @hirosassa). See also the new docs on cache_task_completion (#667, @hirosassa).
  • gs:// dumps make 1 request instead of 3 (labels in the upload request) and do not poll after writing (#640, #635, @kitagry); label computation is skipped for non-GCS targets (#625, @hirosassa).
  • LargeDataFrameProcessor sizes chunks without copying the DataFrame (#668, @hirosassa).

Bug fixes

  • delete_local_unnecessary_outputs no longer deletes needed outputs when workspace_directory starts with ./, including the default ./resources/ (#671, @kitagry).
  • gokart.build(..., parallel_scheduling=True) no longer hangs (#656, @kitagry).
  • With should_lock_run=True and workers > 1, a lock conflict waits and retries instead of failing the build (#587, @mski-iksm). If the run lock cannot be created, only that task fails (#650, @kitagry).
  • S3Config builds a separate boto3 client in each forked process (#661, @kitagry).
  • modification_time_check works with a mix of local / in-memory and S3 / GCS targets (#645, @mayankdhingra02).
  • Plain luigi targets (e.g. luigi.LocalTarget) work in modification_time_check, delete_local_unnecessary_outputs and task info (#665, @kitagry).
  • ModelTarget uses a unique working directory per load / dump (#601, @kitagry), labels ModelTarget zips on gs:// (#633, @hirosassa), and ModelTarget.remove() deletes the local zip (#595, @kitagry).
  • LargeDataFrameProcessor loads chunks in order and avoids empty or stale chunks (#592, @kitagry; #644, @hirosassa).
  • load_generator() yields loaded values for dict inputs (#591, @kitagry); get_task_params() returns the task params and module_versions logs are no longer empty (#594, @kitagry).
  • gokart.build no longer leaks a failure event handler and restores logging.disable (#597, @kitagry).
  • A broken install of an extra (redis, s3, gcs, polars) re-raises the original ImportError instead of a misleading install hint (#660, #663, #677, @kitagry).
  • gokart.utils.add_config works under python -O (#611, @hirosassa); ExplicitBoolParameter forwards keyword arguments (#596, @kitagry); ObjectStorage raises ValueError for a non-object-storage path (#700, @kitagry).
  • GokartBuildError is picklable, so raising it in a process pool no longer hangs (#702, @kitagry).
  • gokart.build with workers > 1 collects the exceptions of failed tasks (#704, @kitagry).

Docs and internal

Full Changelog: v1.13.0...v1.14.0