cli icon indicating copy to clipboard operation
cli copied to clipboard

Add ApplyPythonMutator

Open kanterov opened this issue 9 months ago • 1 comments

Changes

Add ApplyPythonMutator, which will fork the Python subprocess and process pipe bundle configuration through it.

It's enabled through experimental section, for example:

experimental:
  enable_pydabs: true
  venv:
    path: .venv

For now, it's limited to two phases in the mutator pipeline:

  • preinit: adds new jobs
  • init: adds new jobs, or modifies existing ones

It's enforced that no jobs are modified in preinit and not jobs are deleted in preinit/init, because, otherwise, it will break existing assumptions.

This is stacked on top of https://github.com/databricks/cli/pull/1428

Tests

Unit tests

kanterov avatar May 14 '24 12:05 kanterov

Codecov Report

Attention: Patch coverage is 70.42254% with 42 lines in your changes missing coverage. Please review.

Project coverage is 54.96%. Comparing base (e22dd8a) to head (48d9328). Report is 146 commits behind head on main.

Files Patch % Lines
...ndle/config/mutator/python/apply_python_mutator.go 83.18% 10 Missing and 9 partials :warning:
libs/process/opts.go 0.00% 12 Missing :warning:
bundle/config/mutator/python/log_writer.go 28.57% 10 Missing :warning:
bundle/config/mutator/mutator.go 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1430      +/-   ##
==========================================
+ Coverage   52.25%   54.96%   +2.71%     
==========================================
  Files         317      353      +36     
  Lines       18004    16238    -1766     
==========================================
- Hits         9408     8926     -482     
+ Misses       7903     6499    -1404     
- Partials      693      813     +120     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 14 '24 12:05 codecov-commenter

@pietern can you please take a look, since the last time:

  • merge.Override has changed, so now we implement OverrideVisitor here, I added tests for it as well
  • left a bare minimum code to log stderr for the Python process, to be continued as a follow-up
  • addressed remaining comments

kanterov avatar May 17 '24 14:05 kanterov

@pietern I've addressed all comments, and also renamed "pre-init" to "load" as we discussed offline

kanterov avatar Jun 19 '24 13:06 kanterov

@pietern thanks for the review, can you please add to the merge queue?

kanterov avatar Jun 20 '24 07:06 kanterov