Hi Chaim,

You can checkout PipelineResult
<https://github.com/apache/beam/blob/master/sdks/python/apache_beam/runners/runner.py#L342>
class and do something like:

result = p.run()
result.wait_until_finish(duration=TIMEOUT_SEC)
if not PipelineState.is_terminal(result.state):
  result.cancel()

The implementation of PipelineResult
<https://github.com/apache/beam/blob/master/sdks/python/apache_beam/runners/runner.py#L342>
depends on what runner you choose. And you may find more useful functions
in its subclass.

Mark


On Sun, Jul 7, 2019 at 12:59 AM Chaim Turkel <ch...@behalf.com> wrote:

> Hi,
>   I have a pipeline that usually takes 15-30 minutes. Sometimes things
> get stuck (from 3rd party side). I would like to know if there is a
> way to cancel the job if it is running for more than x minutes? I know
> there is a cli command but i would like it either on the pipeline
> config or in the python sdk.
> Any ideas?
>
> Chaim Turkel
>
> --
>
>
> Loans are funded by
> FinWise Bank, a Utah-chartered bank located in Sandy,
> Utah, member FDIC, Equal
> Opportunity Lender. Merchant Cash Advances are
> made by Behalf. For more
> information on ECOA, click here
> <https://www.behalf.com/legal/ecoa/>. For important information about
> opening a new
> account, review Patriot Act procedures here
> <https://www.behalf.com/legal/patriot/>.
> Visit Legal
> <https://www.behalf.com/legal/> to
> review our comprehensive program terms,
> conditions, and disclosures.
>

Reply via email to