Submits a case for calculation
Submits the case with the given id.
:param int resolution:
what resolution you want it to have. The possible values are: '0 = conceptual' -- '1 = detailed' -- '2 = draft'
:param int case_Id:
id of the case you want to submit
:param int credits:
the amount of credits you want to use for the submission
:param string estimated_time:
optional parameter to set the amount of time before the results have to be available. An example of this parameter is:
"P44DT4H", this means 44 days and 4 hours (its a representation of a duration or time interval following the ISO 8601 duration format)
:param int processing_method:
optional parameter for how you want the case to be processed.
The possible values are: '0 = correlation' -- '1 = cfd' -- '2 = cfd reinforced'
:param int priority_level:
optional parameter to select a priority level for the case. Possible values are: '0 = low' -- '1 = medium' -- '2 = high'
def submit_case(self, resolution, case_Id, credits, estimated_time=None, processing_method=None, priority_level=None):
cases_url = self.caseserver_url + "/cases/submit"
payload = json.dumps({"resolution": resolution,"caseId": case_Id,"credits": credits})
#for the optional values
if estimated_time is not None:
payload = api._add_to_payload(payload, json.dumps({"estimatedTime": estimated_time}))
if processing_method is not None:
payload = api._add_to_payload(payload, json.dumps({"processingMethod": processing_method}))
if priority_level is not None:
payload = api._add_to_payload(payload, json.dumps({"priorityLevel": priority_level}))
response = requests.post(cases_url, data=payload, headers=self.put_header)
if(response.ok): print("case submission successful", "\n")
else:
logger.error(f"case submission failed: {response.content}")
raise Exception