-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
888b9f8
to
fc1e3f8
Compare
async purgeInstanceById(instanceId: string,): Promise<PurgeResult | undefined> { | ||
const req = new pb.PurgeInstancesRequest; | ||
req.setInstanceid(instanceId); | ||
console.log(`Purging Instance '${instanceId}'`); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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); | |||
} | |||
|
There was a problem hiding this comment.
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 () => { |
There was a problem hiding this comment.
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 () => {
This PR resolving #12
Merge order: merge after #14