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

Issue 501 - C2D getJobStatus - did vs documentId vs agreementId #502

Merged
merged 22 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
127e0f7
support for legacy field name
paulo-ocean Jun 19, 2024
b1bc9fb
Merge branch 'develop' into issue-501-documentId
paulo-ocean Jun 19, 2024
254aba2
some fixes on fields names, call to get status
paulo-ocean Jun 19, 2024
16621ff
rm did and documentId, the field should be agreementId instead
paulo-ocean Jun 19, 2024
9a0ac28
put it back, need more thinking
paulo-ocean Jun 19, 2024
0f4261c
fix tests, refactor field
paulo-ocean Jun 19, 2024
4173f1b
Merge branch 'develop' into issue-501-documentId
paulo-ocean Jun 21, 2024
5c2e376
Merge branch 'develop' into issue-501-documentId
paulo-ocean Jun 21, 2024
850e968
Merge branch 'develop' into issue-501-documentId
paulo-ocean Jun 25, 2024
7b689d1
Merge branch 'develop' into issue-501-documentId
paulo-ocean Jun 25, 2024
fe53a71
Merge branch 'develop' into issue-501-documentId
paulo-ocean Jun 26, 2024
15a300c
remove TODO
paulo-ocean Jun 28, 2024
561a136
Merge branch 'develop' into issue-501-documentId
paulo-ocean Jun 28, 2024
7af4c35
Merge branch 'develop' into issue-501-documentId
paulo-ocean Jun 28, 2024
490a094
Merge branch 'develop' into issue-501-documentId
paulo-ocean Jul 25, 2024
e3b9a50
Merge branch 'develop' into issue-501-documentId
paulo-ocean Jul 29, 2024
c0085d5
Merge branch 'develop' into issue-501-documentId
paulo-ocean Aug 5, 2024
1c99db3
Merge branch 'main' into issue-501-documentId
paulo-ocean Aug 26, 2024
cd5364c
Merge branch 'main' into issue-501-documentId
paulo-ocean Sep 16, 2024
89a2762
fix ci deprecated versions
paulo-ocean Sep 16, 2024
b38f03a
fix ci deprecated versions
paulo-ocean Sep 16, 2024
734a33e
fix ci deprecated versions
paulo-ocean Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/@types/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ export interface ComputeGetResultCommand extends Command {

export interface ComputeGetStatusCommand extends Command {
consumerAddress?: string
did?: string
jobId?: string
agreementId?: string
}

export interface ValidateChainId {
Expand Down
7 changes: 4 additions & 3 deletions src/components/core/compute/getStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export class ComputeGetStatusHandler extends Handler {
return buildInvalidRequestMessage(
'Parameter : "consumerAddress" is not a valid web3 address'
)
} else if (!command.consumerAddress && !command.jobId && !command.did) {
const error = 'Missing jobId or consumerAddress or did'
} else if (!command.consumerAddress && !command.jobId && !command.agreementId) {
const error = 'Missing one of ["jobId","consumerAddress","agreementId"]'
CORE_LOGGER.logMessage(error, true)
return buildInvalidRequestMessage(error)
}
Expand Down Expand Up @@ -50,11 +50,12 @@ export class ComputeGetStatusHandler extends Handler {
allC2dClusters = allC2dClusters.filter((arr) => arr.hash === hash)
jobId = task.jobId.slice(index + 1)
}

for (const cluster of allC2dClusters) {
const engine = await C2DEngine.getC2DByHash(cluster.hash)
const jobs = await engine.getComputeJobStatus(
task.consumerAddress,
task.did,
task.agreementId,
jobId
)
response.push(...jobs)
Expand Down
4 changes: 2 additions & 2 deletions src/components/httpRoutes/compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ computeRoutes.get(`${SERVICES_API_BASE_PATH}/compute`, async (req, res) => {
command: PROTOCOL_COMMANDS.COMPUTE_GET_STATUS,
node: (req.query.node as string) || null,
consumerAddress: (req.query.consumerAddress as string) || null,
did: (req.query.did as string) || null,
paulo-ocean marked this conversation as resolved.
Show resolved Hide resolved
jobId: (req.query.jobId as string) || null
jobId: (req.query.jobId as string) || null,
agreementId: (req.query.agreementId as string) || null
}
const response = await new ComputeGetStatusHandler(req.oceanNode).handle(
statusComputeTask
Expand Down
4 changes: 2 additions & 2 deletions src/test/integration/compute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ describe('Compute', () => {
const statusComputeTask: ComputeGetStatusCommand = {
command: PROTOCOL_COMMANDS.COMPUTE_GET_STATUS,
consumerAddress: null,
did: null,
agreementId: null,
jobId
}
const response = await new ComputeGetStatusHandler(oceanNode).handle(
Expand All @@ -631,7 +631,7 @@ describe('Compute', () => {
const statusComputeTask: ComputeGetStatusCommand = {
command: PROTOCOL_COMMANDS.COMPUTE_GET_STATUS,
consumerAddress: wallet.address,
did: null,
agreementId: null,
jobId: null
}
const response = await new ComputeGetStatusHandler(oceanNode).handle(
Expand Down
Loading