You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 27, 2022. It is now read-only.
## Testing OpenVino Object detection with Python worker
77
+
78
+
### Testing OpenVino (without Avalon)
79
+
80
+
- For non SGX mode, execute below steps from [cppopenvino](http://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/cppopenvino) directory
2. Start Avalon containers. This will also start Avalon python openvino workload and openvino containers running inside Graphene-SGX in detached mode.
113
+
114
+
`docker-compose -f openvino-sgx.yaml up -d`
115
+
116
+
- In case of Intel SGX, Graphene-SGX openvino python workload and openvino containers will take around 3 minutes to get ready. To view the logs of python worker and openvino containers, execute the following command:
- To send openvino work orders to python worker, we can use [generic client](https://github.com/hyperledger/avalon/tree/master/examples/apps/generic_client) application. Execute the following commands:
121
+
122
+
1. Get into Avalon Shell container : `sudo docker exec -it avalon-shell bash`
123
+
124
+
2. cd `/project/avalon/examples/apps/generic_client/`
125
+
126
+
3. Send openvino work order request with *"ov-inference"* workload id to Graphene worker *"graphene-worker-1"*
If everything goes fine, then you should see the following output in stdout:
131
+
132
+
*Decryption result at client - Openvino Success: Generated output file: street.bmp*
133
+
134
+
output file *street.bmp* will be present in *output* folder in Avalon repository top level directory.
135
+
136
+
- To restart the openvino python workload we have to first bring all the containers down before bringing it up again. This is to ensure that python worker generates new worker signing and encryption keys and Avalon Graphene Enclave Manager gets the updated signup information from python worker.
137
+
138
+
- If Intel SGX is not used, execute the command: `docker-compose -f openvino.yaml down`
139
+
140
+
- For Intel SGX, execute the command: `docker-compose -f openvino-sgx.yaml down`
141
+
76
142
## Known issues
77
143
78
144
- Graphene Production blockers: [oscarlab/graphene#1544](https://github.com/oscarlab/graphene/issues/1544)
Licensed under Creative Commons Attribution 4.0 International License
3
+
https://creativecommons.org/licenses/by/4.0/
4
+
-->
5
+
6
+
# Hyperledger Avalon Python Workload for Graphene SGX
7
+
8
+
## Building and Running the Fibonacci python workload without Intel SGX
9
+
10
+
- To build Avalon Python worker run the following command from [python_worker](https://github.com/hyperledger/avalon/tree/master/tc/graphene/python_worker) directory:
11
+
12
+
`docker-compose build`
13
+
14
+
This will create docker image *avalon-python-worker-dev*. This image contains Avalon python worker, hello workload and a test application to send fibonacci work orders to python worker.
15
+
16
+
- To build Fibonacci python workload, run the following command from [fibonacci](https://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_workloads/fibonacci) directory.
17
+
`docker-compose build`
18
+
19
+
This will create docker image *avalon-fibonacci-workload-dev*. This image contains Avalon python worker, fibonacci workload and a test application to send fibonacci work orders to python worker.
20
+
21
+
### Test Fibonacci python workload using Avalon
22
+
23
+
- To run fibonacci python workload with Avalon Graphene Enclave Manager, go to Avalon repository top level directory and execute the following command:
- To send work orders to fibonacci workload running python worker we can use [generic client](https://github.com/hyperledger/avalon/tree/master/examples/apps/generic_client) application. Execute following commands:
28
+
29
+
1. Get into Avalon Shell container : `sudo docker exec -it avalon-shell bash`
If everything goes fine, then you should see following output in stdout:
38
+
39
+
*Decryption result at client - Fibonacci number at position 10 = 55*
40
+
41
+
## Building and Running Fibonacci workload in Graphene SGX
42
+
43
+
- Run the following command from Graphene git repository root directory:
44
+
45
+
1. Copy the Graphene python worker GSC build script file *build_gsc_fibonacci_workload.sh* from [here](https://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_workloads/fibonacci/graphene_sgx) to <graphene_repo>/Tools/gsc using following command :
46
+
47
+
`cp <path of build_gsc_fibonacci_workload.sh> Tools/gsc`
48
+
49
+
2. Set *TCF_HOME* to the top level directory of your avalon source repository.
50
+
51
+
`export TCF_HOME=<path of avalon repo top level directory>`
52
+
53
+
3. Graphenize Avalon python worker docker image using following command :
54
+
55
+
`./build_gsc_fibonacci_workload.sh`
56
+
57
+
Above command if run successfully will generate a Graphene based docker image *gsc-avalon-fibonacci-workload-dev*.
58
+
59
+
### Test Fibonacci workload using test client (without Avalon)
60
+
61
+
- To run fibonacci workload as a docker container in Graphene-SGX environment and to use a test application to send work order requests, execute the following command from [fibonacci](https://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_workloads/fibonacci) directory.
Above command will run test work orders listed in file [*test_fib_work_orders.json*](http://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_workloads/fibonacci/tests/test_fib_work_orders.json).
66
+
67
+
### Test Fibonacci workload using Avalon
68
+
69
+
- To run fibonacci workload in Graphene-SGX with Avalon Graphene Enclave Manager, go to Avalon repository top level directory and execute the following commands :
70
+
71
+
1. Start all the required containers in detached mode.
72
+
73
+
`docker-compose -f docker-compose.yaml -f docker/compose/avalon-fib-graphene.yaml -f docker/compose/avalon-fib-gsgx.yaml up -d`
74
+
75
+
2. Graphene-SGX Fibonacci workload service will take around 3 minutes to get ready. Check the logs of graphene python workload using below command
If everything goes fine you should see following log in stdout
80
+
81
+
*graphene-python-workload | Generate worker signing and encryption keys*
82
+
*graphene-python-workload | Start listening to ZMQ for work orders*
83
+
*graphene-python-workload | Bind to zmq port*
84
+
*graphene-python-workload | waiting for next request*
85
+
86
+
3. To send work orders to fibonacci workload running in python worker we can use Avalon generic client application as shown [above](https://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_workloads#test-python-worker-using-avalon).
87
+
88
+
4. To restart the python worker you have to first bring all the containers down before bringing it up again. This is to ensure that python worker generate new keys and Avalon Graphene Enclave Manager gets the updated sign up information from python worker.
Above command will run test work orders listed in file [*test_work_orders.json*](http://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_worker/tests/test_work_orders.json).
38
38
39
-
### Test python worker using Avalon
40
-
41
-
- To run python worker with Avalon Graphene Enclave Manager, go to Avalon repository top level directory and execute the following command:
- To send work orders to python worker we can use [generic client](https://github.com/hyperledger/avalon/tree/master/examples/apps/generic_client) application. Execute following commands:
46
-
47
-
1. Get into Avalon Shell container : `sudo docker exec -it avalon-shell bash`
Above command will run test work orders listed in file [*test_work_orders.json*](http://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_worker/tests/test_work_orders.json).
115
95
116
-
### Test python worker using Avalon
117
-
118
-
- To run python worker in Graphene-SGX with Avalon Graphene Enclave Manager, go to Avalon repository top level directory and execute the following commands :
119
-
120
-
1. Start all the required containers in detached mode.
121
-
122
-
`docker-compose -f docker-compose.yaml -f docker/compose/avalon-graphene.yaml -f docker/compose/avalon-graphene-sgx.yaml up -d`
123
-
124
-
2. Graphene-SGX Python worker will take around 3 minutes to get ready. Check the logs of graphene python worker using below command
If everything goes fine you should see following log in stdout
129
-
130
-
*graphene-python-worker | Generate worker signing and encryption keys*
131
-
*graphene-python-worker | Start listening to ZMQ for work orders*
132
-
*graphene-python-worker | Bind to zmq port*
133
-
*graphene-python-worker | waiting for next request*
134
-
135
-
3. To send work orders to python worker we can use Avalon generic client application as shown [above](https://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_worker#test-python-worker-using-avalon).
136
-
137
-
4. To restart the python worker you have to first bring all the containers down before bringing it up again. This is to ensure that python worker generate new keys and Avalon Graphene Enclave Manager gets the updated sign up information from python worker.
- Avalon Python worker supports two sample workloads: "python-hello" and "python-fib".
144
-
145
-
- List of sample workloads are listed in *workloads.json* file kept in [python_worker](http://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_worker) directory.
- Python sample workloads are is kept in [sample_workloads](http://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_worker/sample_workloads) directory.
159
-
160
-
- To add a new python workload, keep the python workload implementation class in sample workloads directory and also edit the *workloads.json* file to add new workload. The format of workload in *workloads.json* file is as shown below :
161
-
162
-
*"workload-id": {*
163
-
*"module": "<workload python module>",*
164
-
*"class": "<workload implementation class name>"*
165
-
*}*
166
-
167
-
## Testing OpenVino Object detection with Python worker
168
-
169
-
- First build OpenVino docker image and GSC docker image using the steps mentioned in cppopenvino [ReadMe](https://github.com/hyperledger/avalon/blob/master/examples/graphene_apps/cppopenvino/README.md)
170
-
171
-
- Below steps will run sample openvino inference test cases in [test_ov_work_orders.json](http://github.com/hyperledger/avalon/tree/master/examples/graphene_apps/python_worker/tests/test_ov_work_orders.json)
2. Start Avalon containers. This will also start Avalon python worker and openvino containers running inside Graphene-SGX in detached mode.
202
-
203
-
`docker-compose -f openvino-sgx.yaml up -d`
204
-
205
-
- In case of Intel SGX, Graphene-SGX python worker and openvino containers will take around 3 minutes to get ready. To view the logs of python worker and openvino containers, execute the following command:
- To send openvino work orders to python worker, we can use [generic client](https://github.com/hyperledger/avalon/tree/master/examples/apps/generic_client) application. Execute the following commands:
210
-
211
-
1. Get into Avalon Shell container : `sudo docker exec -it avalon-shell bash`
212
-
213
-
2. cd `/project/avalon/examples/apps/generic_client/`
214
-
215
-
3. Send openvino work order request with *"ov-inference"* workload id to Graphene worker *"graphene-worker-1"*
If everything goes fine, then you should see the following output in stdout:
220
-
221
-
*Decryption result at client - Openvino Success: Generated output file: street.bmp*
222
-
223
-
output file *street.bmp* will be present in *output* folder in Avalon repository top level directory.
224
-
225
-
- To restart the python worker we have to first bring all the containers down before bringing it up again. This is to ensure that python worker generates new worker signing and encryption keys and Avalon Graphene Enclave Manager gets the updated signup information from python worker.
226
-
227
-
If Intel SGX is not used, execute the command: `docker-compose -f openvino.yaml down`
228
-
229
-
For Intel SGX, execute the command: `docker-compose -f openvino-sgx.yaml down`
230
-
231
96
## Known issues
232
97
233
98
- Knows issues are captured in GitHub : https://github.com/hyperledger/avalon/issues/621
0 commit comments