[jira] [Created] (FLINK-17609) Execute the script directly when user specified the entry script with "-py" rather than run as module.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-17609) Execute the script directly when user specified the entry script with "-py" rather than run as module.

Shang Yuanchun (Jira)
shuiqiangchen created FLINK-17609:
-------------------------------------

             Summary: Execute the script directly when user specified the entry script with "-py" rather than run as module.
                 Key: FLINK-17609
                 URL: https://issues.apache.org/jira/browse/FLINK-17609
             Project: Flink
          Issue Type: Bug
          Components: API / Python, Client / Job Submission
    Affects Versions: 1.11.0
            Reporter: shuiqiangchen
             Fix For: 1.11.0


Currently, the PythonDriver will always construct the python execution command with "-m" option, which means uses code files will run as a module, E.g, "python -m <module_name>". However, when user specifies the "-py" option followed by the entry script file path, we should directly execute the user specified script, such as "python <entry_script_file_path>".

The difference between "python <entry_script_file_path>" and "python -m <module_name>" is as follow:
    "python <entry_script_file_path>" will add the parent directly of the entry script to the PYTHONPATH so that all modules under the directly can be found when executing the script.
    "python -m <module_name>" will only add the current execution directory to the PYTHONPATH, which may cause "ModuleNotFoundError" when the entry module references other modules under the same directory.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)