Hi!

You talked about status code so I guess you're speaking about the client
that submits the job, not the job itself. Flink jobs does not have "exit
codes", they only have status such as RUNNING and FINISHED.

When you run your user code locally, it is running in a testing
mini-cluster in JVM. So if your client code exits the JVM will also exit
and the job will not be finished properly. However if you submit your job
to the cluster it will be running in the remote cluster. In this case it
doesn't matter whether client has exited or not.

You can check Flink web UI to see if your job has been submitted and
running in the cluster.

Yuval Itzchakov <yuva...@gmail.com> 于2021年12月22日周三 14:48写道:

> I mean it finishes successful and exists with status code 0. Both when
> running locally and submitting to the cluster.
>
> On Wed, Dec 22, 2021, 08:36 Caizhi Weng <tsreape...@gmail.com> wrote:
>
>> Hi!
>>
>> By "the streaming job stops" do you mean the job ends with CANCELED state
>> instead of FINISHED state? Which kind of job are you running? Is it a
>> select job or an insert job? Insert jobs should run continuously once
>> they're submitted. Could you share your user code if possible?
>>
>> Yuval Itzchakov <yuva...@gmail.com> 于2021年12月22日周三 14:11写道:
>>
>>> Hi Caizhi,
>>>
>>> If I don't block on statementset.execute, the job finishes immediately
>>> with exit code 0 and the streaming job stops, and that's not what I want. I
>>> somehow need to block.
>>>
>>>
>>>
>>> On Wed, Dec 22, 2021, 03:43 Caizhi Weng <tsreape...@gmail.com> wrote:
>>>
>>>> Hi!
>>>>
>>>> You can poll the status of that job with REST API [1]. You can tell
>>>> that the job successfully finishes by the FINISHED state and that the job
>>>> fails by the FAILED state.
>>>>
>>>> [1]
>>>> https://nightlies.apache.org/flink/flink-docs-master/docs/ops/rest_api/#jobs-jobid
>>>>
>>>> Yuval Itzchakov <yuva...@gmail.com> 于2021年12月22日周三 02:36写道:
>>>>
>>>>> Hi,
>>>>>
>>>>> Flink 1.14.2
>>>>> Scala 2.12
>>>>>
>>>>> I have a streaming job that executes and I want to infinitely wait for
>>>>> it's completion, or if an exception is thrown during initialization. When
>>>>> using *statementSet.execute().await()*, I get an error:
>>>>>
>>>>> Caused by: org.apache.flink.util.FlinkRuntimeException:* The Job
>>>>> Result cannot be fetched through the Job Client when in Web Submission.*
>>>>> at
>>>>> org.apache.flink.client.deployment.application.WebSubmissionJobClient.getJobExecutionResult(WebSubmissionJobClient.java:88)
>>>>> at
>>>>> org.apache.flink.table.api.internal.InsertResultIterator.hasNext(InsertResultIterator.java:54)
>>>>> ... 7 more
>>>>>
>>>>> This is because the Web Submission via the REST API is using
>>>>> the WebSubmissionJobClient.
>>>>>
>>>>> How can I wait on my Flink SQL streaming job when submitting through
>>>>> the REST API?
>>>>> --
>>>>> Best Regards,
>>>>> Yuval Itzchakov
>>>>>
>>>>

Reply via email to