We have a GCP Dataflow project which requires us to cancel a running Dataflow job.
All we have at the time of cancellation is the Job ID.
From other posts on Stackoverflow, I learned we can cancel a job using something like this:
PipelineResult pipelineResult = pipeline.run();
result.cancel();
However, we don't store the pipelineResult when we create it.
The PipelineResult is just a DataflowPipelineJob. I am wondering if there are any ways I can retrieve a DataflowPipelineJob using its job and cancel it. Something like:
DataflowPipelineJob job = <Get DataflowPipelineJob using Job ID>;
job.cancel();