I am trying to run already deployed job on Flink Cluster using Rest request.
I had success using a simple rest client
POST http://localhost:8081/v1/jars/13775a71-0723-4c62-979b-7e9a9de3a0dc_some.jar/run { "programArgsList" : ["test1", "test2"] }
But I would like to do it from Java and since there already is a RestClusterClient I would love to use that but it is poorly documented
From what I see from the code it looks like there is no such possibility with this RestClusterClient
It looks like it is following closely features implemnted in CLI and documented here https://ci.apache.org/projects/flink/flink-docs-stable/ops/cli.html so any run
command requires passing a jar with the job.
There is no possibility to run already deployed job with this client. Am I right?
Flink's cluster REST API has been designed to work with any REST client. The RestClusterClient
which comes with the flink-clients
module is intended for internal usage. However, you can also use it directly by instantiating it with a correctly set up Flink Configuration
.
The Configuration
is used to retrieve the cluster REST endpoint. Hence, if you configure the wrong REST address or the wrong HA mode, then the RestClusterClient
might not be able to talk to the cluster. If you know where the flink-conf.yaml
with which you have started the cluster is, then I would recommend to use GlobalConfiguration#loadConfiguration(configurationDirectory)
to load it. This should give you a good starting point.
Once you have started the RestClusterClient
you can interact with the cluster via
submitJob
: Submit a new job (only supported if you have a session cluster deployed) requestJobResult
: Result of a job execution; if it's a streaming job, then this might never complete cancel
: Cancel the given job triggerSavepoint
: Trigger a savepoint and return its path listJobs
: List all currently running jobs on the cluster
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.