yagna icon indicating copy to clipboard operation
yagna copied to clipboard

Implement PUT endpoint for allocations to adjust allocation on the go.

Open cryptobench opened this issue 2 years ago • 4 comments

In showcase we would like to be able to adjust our allocations on the go while our task is running. This would aid us in the issue of running out of budget.

Our goal with this endpoint is to loop over the current allocated budget and check our spendings and what's left in the budget. If it gets too low, then we will adjust the budget accordingly.

https://github.com/golemfactory/ya-client/blob/7840c32ecf0bc1b66b094b3a5df992f341f87a32/specs/payment-api.yaml#L605

cryptobench avatar May 25 '23 12:05 cryptobench

@cryptobench I can confirm that currently PUT /allocations/{allocationId} is not implemented.

I will proceed with proceeding this ticket within CORE. However, I am just wondering if workaround is possible in Your scenario. Can You please verify if following workaround would work for your scenario?

  • When identified that budget is getting low:
    • Create new allocation via POST /allocations
    • Use new Allocation to pay for debit notes & invoices via POST /invoices/{invoiceId}/accept. This method can take new AllocationId as a input.
    • Release old allocation via DELETE /allocations/{allocationId}

Let us know if that works for You. Thx!

golmek avatar Jun 12 '23 07:06 golmek

Acceptance Criteria:

  • [x] implement PUT /allocations/{allocationId} in Yagna Payment API
  • [ ] ~~[OPTIONAL] see to the feature being implemented in SDK~~

Additional Information:

  • Payment API specs: https://github.com/golemfactory/ya-client/blob/master/specs/payment-api.yaml

Without Optional - probably 2-4 MD.

golmek avatar Jun 21 '23 08:06 golmek

Acceptance Criteria:

  • implement PUT /allocations/{allocationId} in Yagna Payment API
  • Extend Allocation Tests in Goth
  • [OPTIONAL] Extend our own testing tool to cover Allocation test case

Additional Information:

  • Payment API specs: https://github.com/golemfactory/ya-client/blob/master/specs/payment-api.yaml

Without Optional - probably 2-4 MD.

Thank you for the reply. Sorry for not replying to the previous one - I forgot that. I consulted the workaround with the SDK and it was not trivial , so we do very much appreciate the effort Core puts into this PUT endpoint for allocations.

cryptobench avatar Jun 21 '23 11:06 cryptobench

Moved tests to separate ticket: https://github.com/golemfactory/yagna/issues/2770 Marking Implementation as DONE

golmek avatar Sep 20 '23 09:09 golmek