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

Purge instance by ID support #15

Merged
merged 1 commit into from
Dec 12, 2023
Merged

Conversation

kaibocai
Copy link
Member

@kaibocai kaibocai commented Dec 7, 2023

This PR resolving #12

Merge order: merge after #14

@kaibocai kaibocai marked this pull request as ready for review December 11, 2023 13:45
@kaibocai kaibocai force-pushed the kaibocai/purge-instance-support branch from 888b9f8 to fc1e3f8 Compare December 12, 2023 17:09
@kaibocai kaibocai merged commit 355a611 into main Dec 12, 2023
2 of 3 checks passed
async purgeInstanceById(instanceId: string,): Promise<PurgeResult | undefined> {
const req = new pb.PurgeInstancesRequest;
req.setInstanceid(instanceId);
console.log(`Purging Instance '${instanceId}'`);
Copy link
Member

Choose a reason for hiding this comment

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

nit, new line before/after console logs. New line after const prom = promisify... line.

console.log(`Purging Instance '${instanceId}'`);
const prom = promisify(this._stub.purgeInstances.bind(this._stub));
// Execute the request and wait for the first response or timeout
const res = (await prom(req)) as pb.PurgeInstancesResponse;
Copy link
Member

Choose a reason for hiding this comment

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

Why not create PurgeResult here directly?

@@ -54,3 +55,15 @@ export function newOrchestrationState(
failureDetails,
);
}

export function newPurgeResult(
Copy link
Member

Choose a reason for hiding this comment

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

We can remove this if we directly create PurgeResult above.

@@ -191,4 +191,14 @@ export class TaskHubGrpcClient {
const prom = promisify(this._stub.resumeInstance.bind(this._stub));
await prom(req);
}

async purgeInstanceById(instanceId: string,): Promise<PurgeResult | undefined> {

Choose a reason for hiding this comment

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

Should it be purgeOrchestration? in sync with other methods

@@ -191,4 +191,14 @@ export class TaskHubGrpcClient {
const prom = promisify(this._stub.resumeInstance.bind(this._stub));
await prom(req);
}

Choose a reason for hiding this comment

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

Please add doc for purge method

expect(state?.instanceId).toEqual(id);
expect(state?.failureDetails).toBeUndefined();
expect(state?.runtimeStatus).toEqual(OrchestrationStatus.ORCHESTRATION_STATUS_COMPLETED);
expect(state?.serializedInput).toEqual(JSON.stringify(15));
expect(state?.serializedOutput).toEqual(JSON.stringify(16));
}, 31000);

it("should be able purge orchestration", async () => {

Choose a reason for hiding this comment

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

nit typo:

it("should be able to purge orchestration", async () => {

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.

3 participants