[Question] Environment of Python Task is different from that of real worker container
See original GitHub issueMy DS system is setup by Docker.
When I ran like this in a PythonTask, I found that env is different from what i got in the docker container of worker.
This is what env showed by the Python Task.
And this is what env showed by execute
os.system("env")
or os.environ
directly in the container of worker.
I don’t know why they are totally different, especially the Variable ‘PATH’. I thought that docker container is exactly where python executes script. So i am confused
Which version of DolphinScheduler: -[1.3.6-release]
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Problem running celery in a different docker container than the ...
I've found that It works only if I add this to the docker-compose definition of the celery service: environment: - C_FORCE_ROOT=true.
Read more >Best practices for containerizing Python applications with Docker
In this post, we'll attend to those concerns and take a look at some 6 best practices when containerizing Python applications with Docker....
Read more >Task Queue Overview - App Engine - Google Cloud
Task queues come in two flavors, push and pull. The manner in which the Task Queue service dispatches task requests to worker services...
Read more >Top 50 Kubernetes Interview Questions and Answer for 2023
How is Kubernetes different from Docker Swarm? What is Kubernetes? How is Kubernetes related to Docker? What is the difference between deploying ...
Read more >Environment Dependencies — Ray 2.1.0
Your Ray script may import/depend on some Python packages. ... You can specify different runtime environments per-actor or per-task using .options() or the ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@wangdazhong001 Under different user, the result of
env
is different. Regardless of whether it is in the docker container, the same thing happens in linux on the host machine. The richer environment variables directly in the container of worker occur underroor
user. While the environment variables from the python task occur under the user whose id is 2.Since the python script does not execute
source /opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh
, the python task cannot read the environment variables in this file.If you want to access the environment variables from
/opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh
, there are four solutions:open('/opt/dolphinscheduler/conf/env/dolphinscheduler_env.sh', 'r')
and parse itpython-dotenv
Close since it has been replied