Skip to content
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

[Feature][python] Remove public call in PythonGateway code #10990

Open
2 of 3 tasks
zhongjiajie opened this issue Jul 15, 2022 · 1 comment
Open
2 of 3 tasks

[Feature][python] Remove public call in PythonGateway code #10990

zhongjiajie opened this issue Jul 15, 2022 · 1 comment
Labels
feature new feature help wanted Extra attention is needed Python

Comments

@zhongjiajie
Copy link
Member

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

after #10989 finishes, all functions in PythonGateway just look like

public Tenant createTenant(String tenantCode, String desc, String queueName) {
return tenantService.createTenantIfNotExists(tenantCode, desc, queueName, queueName);
}
and maybe we can find some way not declaire the function in PythonGateway, and directly import this function from python api side, we currently have some simple code in
def test_python_client_java_import_single():
"""Test import single class from java gateway."""
gateway = JavaGateway()
java_import(gateway.jvm, "org.apache.dolphinscheduler.common.utils.FileUtils")
assert hasattr(gateway.jvm, "FileUtils")
def test_python_client_java_import_package():
"""Test import package contain multiple class from java gateway."""
gateway = JavaGateway()
java_import(gateway.jvm, "org.apache.dolphinscheduler.common.utils.*")
# test if jvm view have some common utils
for util in ("FileUtils", "OSUtils", "DateUtils"):
assert hasattr(gateway.jvm, util)

and maybe we can do some things like that, and maybe at last our PythonGateway will only have

@PostConstruct
public void init() {
if (pythonGatewayConfiguration.getEnabled()) {
this.start();
}
}
private void start() {
GatewayServer server;
try {
InetAddress gatewayHost = InetAddress.getByName(pythonGatewayConfiguration.getGatewayServerAddress());
InetAddress pythonHost = InetAddress.getByName(pythonGatewayConfiguration.getPythonAddress());
server = new GatewayServer(
this,
pythonGatewayConfiguration.getGatewayServerPort(),
pythonGatewayConfiguration.getPythonPort(),
gatewayHost,
pythonHost,
pythonGatewayConfiguration.getConnectTimeout(),
pythonGatewayConfiguration.getReadTimeout(),
null
);
GatewayServer.turnLoggingOn();
logger.info("PythonGatewayService started on: " + gatewayHost.toString());
server.start();
} catch (UnknownHostException e) {
logger.error("exception occurred while constructing PythonGatewayService().", e);
}
}
content

Use case

No response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@zhongjiajie zhongjiajie added help wanted Extra attention is needed feature new feature Python labels Jul 15, 2022
@github-actions
Copy link

Thank you for your feedback, we have received your issue, Please wait patiently for a reply.

  • In order for us to understand your request as soon as possible, please provide detailed information、version or pictures.
  • If you haven't received a reply for a long time, you can join our slack and send your question to channel #troubleshooting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new feature help wanted Extra attention is needed Python
Projects
None yet
Development

No branches or pull requests

1 participant