Commit 3d2045de authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

astakosclient: Support resource reassignment

Add issue_commission wrapper for assigning resources to a new project.
parent d968336b
......@@ -677,6 +677,30 @@ class AstakosClient(object):
return self._issue_commission(request)
def issue_resource_reassignment(self, holder, from_source,
to_source, provisions, name="",
force=False, auto_accept=False):
"""Change resource assignment to another project
"""
request = {}
request["force"] = force
request["auto_accept"] = auto_accept
request["name"] = name
try:
request["provisions"] = []
for resource, quantity in provisions.iteritems():
ps = self.mk_provisions(
holder, from_source, resource, -quantity)
ps += self.mk_provisions(holder, to_source, resource, quantity)
request["provisions"].extend(ps)
except Exception as err:
self.logger.error(str(err))
raise BadValue(str(err))
return self._issue_commission(request)
# ----------------------------------
# do a GET to ``API_COMMISSIONS``
def get_pending_commissions(self):
......
......@@ -153,6 +153,9 @@ retry=0, use_pool=False, pool_size=8, logger=None\ **)**
commission's id (int). Otherwise it raises an AstakosClientException
exception.
**issue_resource_reassignment(**\ holder, from_source, to_source, provisions, name="", force=False, auto_accept=False\ **)**
Change resource assignment to another project
**get_pending_commissions()**
It returns the pending commissions (list of integers). In case of
error it raises an AstakosClientException exception.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment