Implement PUT endpoint for allocations to adjust allocation on the go.
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 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}
- Create new allocation via
Let us know if that works for You. Thx!
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.
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.
Moved tests to separate ticket: https://github.com/golemfactory/yagna/issues/2770 Marking Implementation as DONE