-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add dest_dir into pythonpath before loading modules #2692
Conversation
Signed-off-by: Nelson Chen <asd3431090@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2692 +/- ##
============================================
- Coverage 100.00% 74.40% -25.60%
============================================
Files 5 194 +189
Lines 122 19726 +19604
Branches 0 2865 +2865
============================================
+ Hits 122 14677 +14555
- Misses 0 4312 +4312
- Partials 0 737 +737 ☔ View full report in Codecov by Sentry. |
flytekit/bin/entrypoint.py
Outdated
@@ -376,6 +377,8 @@ def _execute_task( | |||
dynamic_addl_distro, | |||
dynamic_dest_dir, | |||
) as ctx: | |||
if all(os.path.realpath(path) != dynamic_dest_dir for path in sys.path): | |||
sys.path.append(dynamic_dest_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add dest_dir to PYTHONPATH instead of dynamic_dest_dir
Signed-off-by: Nelson Chen <asd3431090@gmail.com>
Signed-off-by: Nelson Chen <asd3431090@gmail.com>
I think it's better to add |
flytekit/bin/entrypoint.py
Outdated
@@ -549,7 +549,13 @@ def fast_execute_task_cmd(additional_distribution: str, dest_dir: str, task_exec | |||
|
|||
# Use the commandline to run the task execute command rather than calling it directly in python code | |||
# since the current runtime bytecode references the older user code, rather than the downloaded distribution. | |||
p = subprocess.Popen(cmd) | |||
env = os.environ.copy() | |||
if all(os.path.realpath(path) != dest_dir for path in sys.path) and dest_dir is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new process may have a different sys.path
that is not connected to the current process.
I think it's okay to just check for dest_dir is not None
.
Signed-off-by: Nelson Chen <asd3431090@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add --destination-dir
to this test?
Signed-off-by: Nelson Chen <asd3431090@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arbaobao Can you sync up your PR with master
? I think this is good to go!
@thomasjpfan I have synced this PR. |
Signed-off-by: Nelson Chen <asd3431090@gmail.com>
Signed-off-by: Nelson Chen <asd3431090@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Signed-off-by: Nelson Chen <asd3431090@gmail.com>
Tracking issue
Why are the changes needed?
According to issue#2673, it seems better to add
dest_dir
before loading the modules.What changes were proposed in this pull request?
This change will add
dest_dir
before loading the modules.How was this patch tested?
Run workflow with
--destination-dir=/xxx
.For example,
pyflyte run --remote --destination-dir=/tmp flytekit-example/hello_world.py hello_world_wf
Setup process
Screenshots
Check all the applicable boxes
Related PRs
issue#2673
Docs link