[jira] [Created] (FLINK-22728) a problem of loading udf

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

[jira] [Created] (FLINK-22728) a problem of loading udf

Shang Yuanchun (Jira)
JYXL created FLINK-22728:
----------------------------

             Summary: a problem of loading udf
                 Key: FLINK-22728
                 URL: https://issues.apache.org/jira/browse/FLINK-22728
             Project: Flink
          Issue Type: Bug
          Components: API / Python
    Affects Versions: 1.13.0
         Environment: python3.7
centos 8
pyflink1.13.0
java1.11
            Reporter: JYXL


hi:
 I'm using the stream udf by python.
 udf as bellow:
 
 class MyKeySelector(KeySelector):
 def __init__(self, partitions: int=6):
 self.partitions = partitions
 def get_key(self, value):
 return random.randint(0, self.partitions)
 
 when I code it with the main task in the same script, it works,
 but when I make it in a simgle script, it cannot work.
 the archives as bellow:
 
 project:
 | __init__.py
 | key_function.py
 | main_task.py
 
 I'm confused when I use env.add_python_file method, it cannot work either,
 no matter the parameter `file_path` is '~/project' or '~/project/key_function.py.



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