cvdlink 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- FeatureCloud/__init__.py +0 -0
- FeatureCloud/api/__init__.py +0 -0
- FeatureCloud/api/cli/__init__.py +0 -0
- FeatureCloud/api/cli/__main__.py +115 -0
- FeatureCloud/api/cli/app/__init__.py +0 -0
- FeatureCloud/api/cli/app/commands.py +182 -0
- FeatureCloud/api/cli/controller/__init__.py +0 -0
- FeatureCloud/api/cli/controller/commands.py +181 -0
- FeatureCloud/api/cli/test/__init__.py +0 -0
- FeatureCloud/api/cli/test/commands.py +251 -0
- FeatureCloud/api/cli/test/workflow/__init__.py +0 -0
- FeatureCloud/api/cli/test/workflow/commands.py +32 -0
- FeatureCloud/api/imp/__init__.py +0 -0
- FeatureCloud/api/imp/app/__init__.py +0 -0
- FeatureCloud/api/imp/app/commands.py +278 -0
- FeatureCloud/api/imp/controller/__init__.py +0 -0
- FeatureCloud/api/imp/controller/commands.py +246 -0
- FeatureCloud/api/imp/exceptions.py +29 -0
- FeatureCloud/api/imp/test/__init__.py +0 -0
- FeatureCloud/api/imp/test/api/__init__.py +0 -0
- FeatureCloud/api/imp/test/api/backend/__init__.py +0 -0
- FeatureCloud/api/imp/test/api/backend/auth.py +54 -0
- FeatureCloud/api/imp/test/api/backend/project.py +84 -0
- FeatureCloud/api/imp/test/api/controller.py +97 -0
- FeatureCloud/api/imp/test/commands.py +124 -0
- FeatureCloud/api/imp/test/helper.py +40 -0
- FeatureCloud/api/imp/util.py +45 -0
- FeatureCloud/app/__init__.py +0 -0
- FeatureCloud/app/api/__init__.py +0 -0
- FeatureCloud/app/api/http_ctrl.py +48 -0
- FeatureCloud/app/api/http_web.py +16 -0
- FeatureCloud/app/engine/__init__.py +0 -0
- FeatureCloud/app/engine/app.py +1214 -0
- FeatureCloud/app/engine/library.py +46 -0
- FeatureCloud/workflow/__init__.py +0 -0
- FeatureCloud/workflow/app.py +197 -0
- FeatureCloud/workflow/controller.py +17 -0
- FeatureCloud/workflow/example_wf.py +83 -0
- FeatureCloud/workflow/workflow.py +86 -0
- cvdlink-0.1.1.dist-info/METADATA +176 -0
- cvdlink-0.1.1.dist-info/RECORD +45 -0
- cvdlink-0.1.1.dist-info/WHEEL +5 -0
- cvdlink-0.1.1.dist-info/entry_points.txt +5 -0
- cvdlink-0.1.1.dist-info/licenses/LICENSE +201 -0
- cvdlink-0.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
import stat
|
|
4
|
+
|
|
5
|
+
import docker
|
|
6
|
+
|
|
7
|
+
from FeatureCloud.api.imp.exceptions import DockerNotAvailable
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def getcwd_fslash():
|
|
11
|
+
"""
|
|
12
|
+
Returns the current working directory and makes sure it contains forward slashes as separator.
|
|
13
|
+
Hint: os.getcwd() result contains backslashes on Windows.
|
|
14
|
+
"""
|
|
15
|
+
return os.getcwd().replace("\\", "/")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_docker_client():
|
|
19
|
+
"""
|
|
20
|
+
Gets the docker client
|
|
21
|
+
|
|
22
|
+
Raises:
|
|
23
|
+
:py:class:`FeatureCloud.api.imp.exceptions.DockerNotAvailable`
|
|
24
|
+
If the docker API cannot be reached.
|
|
25
|
+
"""
|
|
26
|
+
try:
|
|
27
|
+
client = docker.from_env()
|
|
28
|
+
client.version()
|
|
29
|
+
return client
|
|
30
|
+
except docker.errors.DockerException:
|
|
31
|
+
raise DockerNotAvailable()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def remove_dir(path_to_delete: str):
|
|
35
|
+
"""
|
|
36
|
+
Replicates the Linux command 'rm -rf'
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
def remove_readonly(func, path, e):
|
|
40
|
+
# shutil.rmtree doesn't have the force flag,
|
|
41
|
+
# so we clear the readonly bit and reattempt the removal in the error handler
|
|
42
|
+
os.chmod(path, stat.S_IWRITE)
|
|
43
|
+
os.remove(path)
|
|
44
|
+
|
|
45
|
+
shutil.rmtree(path_to_delete, onerror=remove_readonly)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
from bottle import Bottle, request
|
|
5
|
+
|
|
6
|
+
from FeatureCloud.app.engine.app import app
|
|
7
|
+
|
|
8
|
+
api_server = Bottle()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# CAREFUL: Do NOT perform any computation-related tasks inside these methods, nor inside functions called from them!
|
|
12
|
+
# Otherwise your app does not respond to calls made by the FeatureCloud system quickly enough
|
|
13
|
+
# Use the threaded loop in the app_flow function inside the file logic.py instead
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@api_server.post('/setup')
|
|
17
|
+
def ctrl_setup():
|
|
18
|
+
time.sleep(1)
|
|
19
|
+
print(f'[CTRL] POST /setup')
|
|
20
|
+
payload = request.json
|
|
21
|
+
app.handle_setup(payload.get('id'), payload.get('coordinator'), payload.get('clients'), payload.get('coordinatorID'))
|
|
22
|
+
return ''
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@api_server.get('/status')
|
|
26
|
+
def ctrl_status():
|
|
27
|
+
# print(f'[CTRL] GET /status')
|
|
28
|
+
return app.handle_status()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@api_server.route('/data', method='GET')
|
|
32
|
+
def ctrl_data_out():
|
|
33
|
+
print(f'[CTRL] GET /data')
|
|
34
|
+
return app.handle_outgoing()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@api_server.route('/data', method='POST')
|
|
38
|
+
def ctrl_data_in():
|
|
39
|
+
print(f'[CTRL] POST /data')
|
|
40
|
+
if "memo" in request.query:
|
|
41
|
+
# The memo is URL-encoded, we compare later with the memo URL-encoded as well
|
|
42
|
+
# we have to keep the URl-encoding here
|
|
43
|
+
memo = request.query["memo"]
|
|
44
|
+
else:
|
|
45
|
+
memo = None
|
|
46
|
+
return app.handle_incoming(request.body.read(), request.query['client'],
|
|
47
|
+
memo=memo)
|
|
48
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from bottle import Bottle
|
|
2
|
+
|
|
3
|
+
from FeatureCloud.app.engine.app import app
|
|
4
|
+
|
|
5
|
+
web_server = Bottle()
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# CAREFUL: Do NOT perform any computation-related tasks inside these methods, nor inside functions called from them!
|
|
9
|
+
# Otherwise your app does not respond to calls made by the FeatureCloud system quickly enough
|
|
10
|
+
# Use the threaded loop in the app_flow function inside the file logic.py instead
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@web_server.route('/')
|
|
14
|
+
def index():
|
|
15
|
+
print(f'[WEB] GET /')
|
|
16
|
+
return f'State: {app.current_state.name}'
|
|
File without changes
|