Check if workflow with workflow-id and/or run-id is open

I basically want to check if a workflow is open with the given type and workflow id, If it is open get the run id. I looked around and couldn’t find a way to do this using using WorkflowClient, the only way seems to be to use DescribeWorkflowExecution api, please let me know if i am wrong.

Using the DescribeWorkflowExecution API how do i know if the workflow is open or closed? I do see a status field, could you let me know which of these status correspond to an open workflow? Is there a helper method for the same?

DescribeWorkflowExecution API is the way to go. If a workflow is open then

DescribeWorkflowExecutionResult.workflowExecutionInfo.status is equal to WORKFLOW_EXECUTION_STATUS_RUNNING.

What is the use case for this?

I have an api that creates an upload for a feed (parent entity). All this API does it kick off a temporal workflow with the feed-id as the workflow-id and it uses the run-id returned by the workflow as upload-id and returns this back as the response of our api. The workflow is responsible for actually creating and persisting the actual upload entity to our database.

Now i have 2 additional read apis that i need to support

  1. Get all uploads for a feed: Ideally i would have just queried our database to get this. But since the temporal workflow is the one that creates these uploads there is time gap between when i open a workflow and when the first step of the workflow executes (which creates the upload), i also need to look at temporal to get run id for an open workflow
  2. Get upload with the given id(run id): again because of the time gap between when the temporal is kicked off and when the upload is created i need to query temporal to see if a workflow exists for this run id.

As I understand 1 can be done using DescribeWorkflowExecution, Is there a way i can query a workflow just by the run-id for use case 2

@maxim is there any way to check if there is a workflow open given just the run-id (no workflow-id) ?