You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "shuiqiangchen (Jira)" <ji...@apache.org> on 2020/05/11 08:11:00 UTC

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

     [ https://issues.apache.org/jira/browse/FLINK-17609?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

shuiqiangchen updated FLINK-17609:
----------------------------------
    Description: 
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 directory 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.

  was:
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.


> 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
>            Priority: Major
>             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 directory 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)