Repository navigation
⚠️ 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 deprecatedredis_host/redis_port, orshould_lock_run), installgokart[redis](orgokart[all]). Without it, a task that is configured for a Redis lock raisesImportErrorwith 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.buildraisesGokartBuildErrorwhen the build ends asMISSING_EXTorNOT_RUN(#684, @hirosassa). These used to be treated as success, so a build whoseExternalTaskoutput was missing returned normally even though the requested task never ran. Now every status other thanSUCCESS/SUCCESS_WITH_RETRYraises. Make sure external dependencies exist before building, or catchGokartBuildErrorwhere you relied on the old behavior. The newGokartBuildError.status(aluigi.LuigiStatusCode) tellsMISSING_EXT/NOT_RUNapart from a failed task;raised_exceptionsis empty for them.
Other behavior changes worth checking
- Tasks with
should_lock_run=Truetake the run lock in the gokart worker (gokart.build/gokart.run). Under plainluigi.buildor the luigi CLI, no run lock is taken;dump()falls back to the dump lock and emits aUserWarning(#605, @kitagry). - The completion check just before
run()is done only by the gokart worker.gokart/task_complete_check.pyis removed, and--test-run-pandasnow really runs every task'srun()(withdumppatched 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 aregoogle.api_core.exceptions.*instead ofgoogleapiclient.errors.HttpError,last_modification_time()of ags://target returns a timezone-awaredatetime, labels are attached in the upload request, and the internal modulegokart.gcs_obj_metadata_clientis removed. Thegcsextra now installsgoogle-cloud-storage>=2. - The
s3extra requiresbotocore>=1.35.69(#649, @hirosassa). .pkloutputs are written with pickle protocol 5, so the bytes differ (files of earlier versions load as before; task ids do not change). AnOSErrorwhile pickling no longer falls back to dill (#688, @kitagry).LargeDataFrameProcessor(max_byte=...)raisesValueErrorformax_byte <= 0(#644, @hirosassa), and DataFrames with object or mixed dtypes may be split into more chunks (#668, @hirosassa).fail_on_empty_dump=Truealso rejects an emptypolars.DataFrame(#672, @kitagry).delete_local_unnecessary_outputslogs 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 fromGOKART_REDIS_PASSWORD(#646, @hirosassa).- Run lock on object storage:
[gokart_lock] url=gs://bucket[/prefix](#647, @hirosassa) ors3://bucket[/prefix], withS3Config.endpoint_urlfor 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 onegokart.build, released as soon as no task needs it (#639, #655, #657, @kitagry). NdjsonFileProcessorfor newline-delimited JSON (.ndjson) (#459, @kitagry).gokart[pandas]extra (pandas>=3,pyarrow), included ingokart[all](#675, @kitagry).- Parallel upload / download of large GCS objects with
[GCSConfig] parallel_upload_threshold/parallel_download_threshold(opt-in; thegcsextra requiresgoogle-cloud-storage>=2.18.2) (#687, @kitagry).
Performance
import gokartno longer imports pandas or polars until they are used: 340 ms → about 150 ms (#666, #675, @kitagry)..pkldumps 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), andmake_task_info_treechecks each task once (#616, @hirosassa). See also the new docs oncache_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).LargeDataFrameProcessorsizes chunks without copying the DataFrame (#668, @hirosassa).
Bug fixes
delete_local_unnecessary_outputsno longer deletes needed outputs whenworkspace_directorystarts with./, including the default./resources/(#671, @kitagry).gokart.build(..., parallel_scheduling=True)no longer hangs (#656, @kitagry).- With
should_lock_run=Trueandworkers > 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). S3Configbuilds a separate boto3 client in each forked process (#661, @kitagry).modification_time_checkworks with a mix of local / in-memory and S3 / GCS targets (#645, @mayankdhingra02).- Plain luigi targets (e.g.
luigi.LocalTarget) work inmodification_time_check,delete_local_unnecessary_outputsand task info (#665, @kitagry). ModelTargetuses a unique working directory per load / dump (#601, @kitagry), labelsModelTargetzips ongs://(#633, @hirosassa), andModelTarget.remove()deletes the local zip (#595, @kitagry).LargeDataFrameProcessorloads 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 andmodule_versionslogs are no longer empty (#594, @kitagry).gokart.buildno longer leaks a failure event handler and restoreslogging.disable(#597, @kitagry).- A broken install of an extra (redis, s3, gcs, polars) re-raises the original
ImportErrorinstead of a misleading install hint (#660, #663, #677, @kitagry). gokart.utils.add_configworks underpython -O(#611, @hirosassa);ExplicitBoolParameterforwards keyword arguments (#596, @kitagry);ObjectStorageraisesValueErrorfor a non-object-storage path (#700, @kitagry).GokartBuildErroris picklable, so raising it in a process pool no longer hangs (#702, @kitagry).gokart.buildwithworkers > 1collects the exceptions of failed tasks (#704, @kitagry).
Docs and internal
- Docs:
cache_task_completion(#667, @hirosassa),persist=Falsewithmodification_time_check/strict_check(#678, @kitagry). - Type checking: pyright in strict mode (#585–#613, @hirosassa).
- Refactoring:
GCSConfigandS3Configshare the per-process client cache (#673, @kitagry). - CI / tests: 80% coverage threshold (#615), tox config in
pyproject.toml(#670),contents: readtoken permissions (#614) (@hirosassa); test cleanups (#589, #662, #676, #641, #643, #653); a test that fails when gokart warns withDeprecationWarning(#699, @kitagry). - Dependency updates by @dependabot (#588, #618–#622, #693, #695, #697).
Full Changelog: v1.13.0...v1.14.0