Skip to content

[BEAM-10702] Do not implicitly decompress artifacts - #12571

Merged
jkff merged 3 commits into
masterfrom
beam-10702
Aug 14, 2020
Merged

[BEAM-10702] Do not implicitly decompress artifacts#12571
jkff merged 3 commits into
masterfrom
beam-10702

Conversation

@jkff

@jkffjkff commented Aug 13, 2020

Copy link
Copy Markdown
Contributor

Context: https://issues.apache.org/jira/browse/BEAM-10702

Looks like the artifact service started with --job_endpoint=embed uses FileSystems.open to read the artifacts to be staged, which by default decompresses the artifacts if they are compressed. PIP packages are compressed as .tar.gz, so when the worker container retrieves the PIP packages to install, they see .tar.gz files whose contents is actually the underlying .tar file.

I would appreciate guidance for where to add tests for this.

  • artifact_service_test uses an in-memory file reader fn that doesn't actually share the code being used in production. Should I change that?
  • worker_handlers_test does not exist - there's fn_runner_test.py in that directory but I'm not sure how to test the artifact staging codepath via there.
  • Do we have any ValidatesRunner tests at all with job_endpoint=embed? If not, how would I go about adding some?

R: @robertwb@pabloem

Post-Commit Tests Status (on master branch)

LangSDKDataflowFlinkSamzaSparkTwister2
GoBuild Status---Build Status---Build Status---
JavaBuild StatusBuild Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build StatusBuild Status
Build Status
Build Status
Build Status
PythonBuild Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
---Build Status---
XLangBuild Status---Build Status---Build Status---

Pre-Commit Tests Status (on master branch)

---JavaPythonGoWebsite
Non-portableBuild StatusBuild Status
Build Status
Build Status
Build StatusBuild Status
Portable---Build Status------

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels

See CI.md for more information about GitHub Actions CI.

@jkffjkff added the python label Aug 13, 2020
@jkff
jkff requested review from pabloem and robertwbAugust 13, 2020 19:15
@tvalentyn

Copy link
Copy Markdown
Contributor

@robertwb@ihji@chamikaramj - do you know what is the status of Portable local runner tests? It sounds like the codepath with the bug that @jkff discovered has no test coverage. Do you have a recommendation or plan to improve testing?

@jkff

jkff commented Aug 13, 2020

Copy link
Copy Markdown
ContributorAuthor

FWIW: I can reproduce this with the local Flink runner too:
python3 main.py --runner=FlinkRunner --environment_type=DOCKER --requirements_file=requirements.txt for the main.py in the thread linked from JIRA - this gives me the same issue.

Are there any tests running with these settings?

Note that the issue reproduces only if there are any compressed artifacts to stage: either a non-empty requirements.txt (then the dependencies are staged) or a setup.py (then we stage workflow.tar.gz)

Maybe there already are some tests, and we can make them have a requirements.txt or setup.py?

@jkff

jkff commented Aug 13, 2020

Copy link
Copy Markdown
ContributorAuthor

Looks like we do have a test with a setup.py - it's the Julia Set example. I'll try to add that as a test.

@tvalentyn

Copy link
Copy Markdown
Contributor

Are there any tests running with these settings?

Likely not exactly, since if we had such tests, they should have been red.

We do exercise --requirements_file=requirements.txt in Dataflow Postcommits, but those postcommits don't exercise the artifact service Python implementation.

I don't think we have a test that exercises Julia Set example as an integration test either (BEAM-10639), so that would be a great addition in test coverage.

@tvalentyn

Copy link
Copy Markdown
Contributor

Current changes LGTM.

@jkff

jkff commented Aug 13, 2020

Copy link
Copy Markdown
ContributorAuthor

Run Python 3.8 PostCommit

@jkff

jkff commented Aug 13, 2020

Copy link
Copy Markdown
ContributorAuthor

Thanks @tvalentyn ! I added a Julia Set test that reproduces the issue and passes with the fix.

@jkff

jkff commented Aug 13, 2020

Copy link
Copy Markdown
ContributorAuthor

(PVR_Flink is already failing - not caused by this PR)

@jkff

jkff commented Aug 14, 2020

Copy link
Copy Markdown
ContributorAuthor

The python precommit test failure is also spurious - unrelated to the PR, and passes for me locally.

@pabloem
pabloem requested a review from tvalentynAugust 14, 2020 01:06

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest moving this to

':runners:spark:job-server:shadowJar',

@jkff

jkff commented Aug 14, 2020

Copy link
Copy Markdown
ContributorAuthor

Thanks @tvalentyn ! Addressed your comment, will merge.

@jkff
jkff merged commit caabb8b into masterAug 14, 2020
@jkff
jkff deleted the beam-10702 branch August 14, 2020 01:21
jkff added a commit that referenced this pull request Aug 18, 2020
Also adds a Julia set test on portable local runner, which uses a
setup.py and hence exercises the artifact staging codepath.
This is a squashed cherrypick of #12571
youngoli pushed a commit that referenced this pull request Aug 19, 2020
…ess artifacts (#12619)
* [BEAM-10702] Do not implicitly decompress artifacts
Also adds a Julia set test on portable local runner, which uses a
setup.py and hence exercises the artifact staging codepath.
This is a squashed cherrypick of #12571
* Add enum34 to manual_licenses
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@jkff@tvalentyn