This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git


The following commit(s) were added to refs/heads/master by this push:
     new 55943b8  Removes magic numbers in Teaclave Python SDK (#632)
55943b8 is described below

commit 55943b81ea0278325a1f3f9d780aeffec3347dc3
Author: Qinkun Bao <[email protected]>
AuthorDate: Sun Mar 6 11:20:42 2022 -0800

    Removes magic numbers in Teaclave Python SDK (#632)
---
 sdk/python/teaclave.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sdk/python/teaclave.py b/sdk/python/teaclave.py
index 9abd762..4cf9930 100644
--- a/sdk/python/teaclave.py
+++ b/sdk/python/teaclave.py
@@ -960,13 +960,13 @@ class FrontendService(TeaclaveService):
                 raise TeaclaveException(
                     f"Failed to get task result ({reason})")
             time.sleep(1)
-            if response["content"]["status"] == 10:
+            if response["content"]["status"] == TaskStatus.Finished:
                 break
-            elif response["content"]["status"] == 20:
+            elif response["content"]["status"] == TaskStatus.Canceled:
                 raise TeaclaveException(
                     "Task Canceled, Error: " +
                     response["content"]["result"]["result"]["Err"]["reason"])
-            elif response["content"]["status"] == 99:
+            elif response["content"]["status"] == TaskStatus.Failed:
                 raise TeaclaveException(
                     "Task Failed, Error: " +
                     response["content"]["result"]["result"]["Err"]["reason"])
@@ -987,7 +987,7 @@ class FrontendService(TeaclaveService):
                 raise TeaclaveException(
                     f"Failed to get output cmac by tag ({reason})")
             time.sleep(1)
-            if response["content"]["status"] == 10:
+            if response["content"]["status"] == TaskStatus.Finished:
                 break
 
         return response["content"]["result"]["result"]["Ok"]["tags_map"][tag]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to