Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong test assertion #46

Merged
merged 17 commits into from
Dec 31, 2024
Merged

Fix wrong test assertion #46

merged 17 commits into from
Dec 31, 2024

Conversation

@v9n v9n changed the base branch from main to chris-sync_to_a3c4ce7 December 27, 2024 19:44
src/index.ts Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
});

// The list should now contain one execution, the id from manual trigger should matched
const execution = await client.getExecution(workflowId, result.executionId);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisli30 This is a new API I added.

When you know the task id, and the executionid, then you can fetch a single execution. Use case:

When you call triggerWorkflow in blocking mode, you will get back the execution_id. At this time there are 2 way to get the full log of that exectuion id.

  1. call listExecutions and pick the first element (desc order)
  2. call getExecution as shown here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, but I’ve got a question.

The isBlocking is to wait for the exeuction to complete, right? My understanding is that:

When isBlocking: true, the triggerWorkflow waits for execution to complete, at this point, it can get the result of getExecution.

Otherwise, when isBlocking: false, the triggerWorkflow runs in async mode, that it will return a tracking id immediately, which can be used later to getExecution. Also, we might need to define a response for pending, in case the getExecution is called too quickly.

Let me know if the two cases make sense. From the Studio, we would always run it in isBlocking mode, and wait for the executiond details.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When isBlocking: true, the triggerWorkflow waits for execution to complete, at this point, it can get the result of getExecution.

Correct. The execution is done. That's why you had an "execution_id". When it's run in async mode, you don't had the executio_id. You just had result: true to mean the trigger is completed. But when it's run, you don't know yet.

Otherwise, when isBlocking: false, the triggerWorkflow runs in async mode, that it will return a tracking id immediately, which can be used later to getExecution. Also, we might need to define a response for pending, in case the getExecution is called too quickly.

No, do you remember other issue where you ask "What is the job id"? In isBlocking: false you don't get back an execution id. You just get back a job_id but we removed it.

When you had an execution id, the execution is finished.

You can safely call getExecution immediately to get the whole log. Ideally we can return the whole execution log as well but I want to keep it the triggerWorkflow response small (so it's very similar in both blocking vs non blocking call).

Let me know if the two cases make sense. From the Studio, we would always run it in isBlocking mode, and wait for the executiond details.

it make sense but we're working as your expected. I think it is just your confusuion about execution_id. Want to make it clear that if you had an execution_id, the trigger is executed, the execution is finished (it may error out such as rest endpoint is down, graphql return wrong datashape but it's execution is completed. If it's async, you don't get an id.


# TODO: remove this before merge
# Pin to this branch to have all the fix
AVS_BUILD_VERSION: passing-result-to-subsequent-steps
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisli30 Once all the AVS PR is merged we can remove this so it's pointed to lastest. right now I pinned it to this branch https://github.com/AvaProtocol/ava-sdk-js/pull/45/files#diff-bccd87d19079cf7b35274281848f7e5a32a070e5101bff9c5b67b58fb82fc16dR15 and you can see all the tests are passed.

Copy link
Member

@chrisli30 chrisli30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local test has passed! I left two comments in the PR but it’s good to merge.

tests/getWorkflows.test.ts Show resolved Hide resolved
});

// The list should now contain one execution, the id from manual trigger should matched
const execution = await client.getExecution(workflowId, result.executionId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, but I’ve got a question.

The isBlocking is to wait for the exeuction to complete, right? My understanding is that:

When isBlocking: true, the triggerWorkflow waits for execution to complete, at this point, it can get the result of getExecution.

Otherwise, when isBlocking: false, the triggerWorkflow runs in async mode, that it will return a tracking id immediately, which can be used later to getExecution. Also, we might need to define a response for pending, in case the getExecution is called too quickly.

Let me know if the two cases make sense. From the Studio, we would always run it in isBlocking mode, and wait for the executiond details.

Base automatically changed from chris-sync_to_a3c4ce7 to main December 29, 2024 22:31
@chrisli30
Copy link
Member

@v9n I squash merged the previous PR but it creates conflicts. Sorry ... could you go over and resolve them? In future, should the one on top be rebased merge?

@v9n
Copy link
Member Author

v9n commented Dec 30, 2024

I squash merged the previous PR but it creates conflicts. Sorry ... could you go over and resolve them?

No problem let me fix it.

In future, should the one on top be rebased merge?

Yes, you would merge in the reverse order from top most, then squash the last one, not other way around.

A -> B -> C -> D

Then you would merge D -> C -> into B, then finally inturn merge B into A(at this time you're safe to squash).

When squashing B into A, that's a new commit. And all the old commit is lost. But these commit are in C, that's why it will replay and cause the conflict.

@v9n v9n merged commit d5dd0fe into main Dec 31, 2024
3 of 4 checks passed
@v9n v9n deleted the fix-wrong-test-assertion branch December 31, 2024 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants