stoobly-agent 1.5.1__py3-none-any.whl → 1.5.2__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.
- stoobly_agent/__init__.py +1 -1
- stoobly_agent/app/cli/scaffold/constants.py +1 -0
- stoobly_agent/app/cli/scaffold/templates/app/.Makefile +7 -10
- stoobly_agent/app/cli/scaffold/templates/app/.docker-compose.base.yml +1 -0
- stoobly_agent/app/cli/scaffold/workflow_run_command.py +7 -1
- stoobly_agent/app/cli/scaffold_cli.py +10 -9
- stoobly_agent/app/models/factories/resource/local_db/helpers/tiebreak_scenario_request.py +3 -3
- {stoobly_agent-1.5.1.dist-info → stoobly_agent-1.5.2.dist-info}/METADATA +1 -1
- {stoobly_agent-1.5.1.dist-info → stoobly_agent-1.5.2.dist-info}/RECORD +12 -12
- {stoobly_agent-1.5.1.dist-info → stoobly_agent-1.5.2.dist-info}/LICENSE +0 -0
- {stoobly_agent-1.5.1.dist-info → stoobly_agent-1.5.2.dist-info}/WHEEL +0 -0
- {stoobly_agent-1.5.1.dist-info → stoobly_agent-1.5.2.dist-info}/entry_points.txt +0 -0
stoobly_agent/__init__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
COMMAND = 'stoobly-agent'
|
2
|
-
VERSION = '1.5.
|
2
|
+
VERSION = '1.5.2'
|
@@ -20,17 +20,15 @@ ca_certs_dir=$$(realpath "$${STOOBLY_CA_CERTS_DIR:-$$(realpath ~)/.mitmproxy}")
|
|
20
20
|
certs_dir=$$(realpath "$${STOOBLY_CERTS_DIR:-$(app_data_dir)/certs}")
|
21
21
|
context_dir=$$(realpath "$${STOOBLY_CONTEXT_DIR:-$(CONTEXT_DIR_DEFAULT)}")
|
22
22
|
|
23
|
-
context_dir_option=--context-dir-path $(context_dir)
|
24
23
|
user_id_option=--user-id $(USER_ID)
|
25
24
|
stoobly_exec_options=--profile $(EXEC_WORKFLOW_NAME) -p $(EXEC_WORKFLOW_NAME)
|
26
25
|
workflow_down_options=$(user_id_option)
|
27
26
|
workflow_service_options=$(shell echo $$STOOBLY_WORKFLOW_SERVICE_OPTIONS)
|
28
|
-
workflow_up_options
|
27
|
+
workflow_up_options=--app-dir-path $(app_dir) --context-dir-path $(context_dir) --ca-certs-dir-path $(ca_certs_dir) --certs-dir-path $(certs_dir) --from-make $(user_id_option)
|
29
28
|
|
30
29
|
app_data_dir=$(app_dir)/.stoobly
|
31
30
|
app_namespace_dir=$(app_data_dir)/docker
|
32
31
|
app_tmp_dir=$(app_data_dir)/tmp
|
33
|
-
data_dir=$(context_dir)/.stoobly
|
34
32
|
dockerfile_path=$(app_namespace_dir)/.Dockerfile.context
|
35
33
|
docker_compose_file_path=$(app_namespace_dir)/stoobly-ui/exec/.docker-compose.exec.yml
|
36
34
|
workflow_run_script=$(app_data_dir)/tmp/run.sh
|
@@ -38,7 +36,7 @@ workflow_run_script=$(app_data_dir)/tmp/run.sh
|
|
38
36
|
# Commands
|
39
37
|
docker_command=docker
|
40
38
|
docker_compose_command=$(docker_command) compose
|
41
|
-
exec_env=
|
39
|
+
exec_env=APP_DIR="$(app_dir)" CA_CERTS_DIR="$(ca_certs_dir)" USER_ID="$(USER_ID)"
|
42
40
|
exec_up=$(docker_compose_command) -f "$(docker_compose_file_path)" $(stoobly_exec_options) up --remove-orphans
|
43
41
|
source_env=set -a; [ -f .env ] && source .env; set +a
|
44
42
|
|
@@ -47,15 +45,14 @@ stoobly_exec_build=$(docker_command) build $(stoobly_exec_build_args) $(app_name
|
|
47
45
|
stoobly_exec_build_args=-f "$(dockerfile_path)" -t stoobly.$(USER_ID) --build-arg USER_ID=$(USER_ID) $(PULL_OPTION) --quiet
|
48
46
|
|
49
47
|
# Exec any
|
50
|
-
stoobly_exec=$(stoobly_exec_build) && $(stoobly_exec_env)
|
51
|
-
stoobly_exec_env=$(source_env) && $(exec_env)
|
48
|
+
stoobly_exec=$(stoobly_exec_build) && $(stoobly_exec_env) $(exec_up)
|
49
|
+
stoobly_exec_env=$(source_env) && $(exec_env) CONTEXT_DIR="$(context_dir)"
|
52
50
|
|
53
51
|
# Exec workflow run
|
54
52
|
# Because scaffold is stored in the application source code directory,
|
55
|
-
# when running a scaffold command from within a container,
|
56
|
-
|
57
|
-
|
58
|
-
stoobly_exec_run_env=$(source_env) && $(exec_env) && export CONTEXT_DIR="$(app_dir)"
|
53
|
+
# when running a scaffold command from within a container, it needs access to $(app_dir) rather than $(context_dir)
|
54
|
+
stoobly_exec_run=$(stoobly_exec_build) && $(stoobly_exec_run_env) $(exec_up)
|
55
|
+
stoobly_exec_run_env=$(source_env) && $(exec_env) CONTEXT_DIR="$(app_dir)"
|
59
56
|
|
60
57
|
# Workflow run
|
61
58
|
workflow_run=$(source_env) && bash "$(workflow_run_script)"
|
@@ -11,7 +11,7 @@ from stoobly_agent.lib.logger import Logger
|
|
11
11
|
|
12
12
|
from .app import App
|
13
13
|
from .constants import (
|
14
|
-
APP_NETWORK_ENV, CA_CERTS_DIR_ENV, CERTS_DIR_ENV, CONTEXT_DIR_ENV, NAMESERVERS_FILE,
|
14
|
+
APP_DIR_ENV, APP_NETWORK_ENV, CA_CERTS_DIR_ENV, CERTS_DIR_ENV, CONTEXT_DIR_ENV, NAMESERVERS_FILE,
|
15
15
|
SERVICE_DNS_ENV, SERVICE_NAME_ENV, USER_ID_ENV, WORKFLOW_NAME_ENV, WORKFLOW_NAMESPACE_ENV
|
16
16
|
)
|
17
17
|
from .docker.constants import DOCKERFILE_CONTEXT
|
@@ -41,12 +41,17 @@ class WorkflowRunCommand(WorkflowCommand):
|
|
41
41
|
def __init__(self, app: App, **kwargs):
|
42
42
|
super().__init__(app, **kwargs)
|
43
43
|
|
44
|
+
self.__app_dir_path = os.path.abspath(kwargs.get('app_dir_path') or app.dir_path)
|
44
45
|
self.__current_working_dir = os.getcwd()
|
45
46
|
self.__ca_certs_dir_path = kwargs.get('ca_certs_dir_path') or app.ca_certs_dir_path
|
46
47
|
self.__certs_dir_path = kwargs.get('certs_dir_path') or app.certs_dir_path
|
47
48
|
self.__context_dir_path = kwargs.get('context_dir_path') or app.context_dir_path
|
48
49
|
self.__network = kwargs.get('network') or self.app_config.network
|
49
50
|
|
51
|
+
@property
|
52
|
+
def app_dir_path(self):
|
53
|
+
return self.__app_dir_path
|
54
|
+
|
50
55
|
@property
|
51
56
|
def ca_certs_dir_path(self):
|
52
57
|
return self.__ca_certs_dir_path
|
@@ -244,6 +249,7 @@ class WorkflowRunCommand(WorkflowCommand):
|
|
244
249
|
user_id = options.get('user_id')
|
245
250
|
|
246
251
|
_config = {}
|
252
|
+
_config[APP_DIR_ENV] = self.app_dir_path
|
247
253
|
_config[CA_CERTS_DIR_ENV] = self.ca_certs_dir_path
|
248
254
|
_config[CERTS_DIR_ENV] = self.certs_dir_path
|
249
255
|
_config[CONTEXT_DIR_ENV] = self.context_dir_path
|
@@ -170,7 +170,7 @@ def create(**kwargs):
|
|
170
170
|
help="List services",
|
171
171
|
name="list"
|
172
172
|
)
|
173
|
-
@click.option('--app-dir-path', default=
|
173
|
+
@click.option('--app-dir-path', default=current_working_dir, help='Path to application directory.')
|
174
174
|
@click.option('--format', type=click.Choice(FORMATS), help='Format output.')
|
175
175
|
@click.option('--select', multiple=True, help='Select column(s) to display.')
|
176
176
|
@click.option('--service', multiple=True, help='Select specific services.')
|
@@ -302,8 +302,6 @@ def copy(**kwargs):
|
|
302
302
|
@click.option('--user-id', default=os.getuid(), help='OS user ID of the owner of context dir path.')
|
303
303
|
@click.argument('workflow_name')
|
304
304
|
def down(**kwargs):
|
305
|
-
cwd = os.getcwd()
|
306
|
-
|
307
305
|
os.environ[env_vars.LOG_LEVEL] = kwargs['log_level']
|
308
306
|
|
309
307
|
app = App(kwargs['app_dir_path'], DOCKER_NAMESPACE, **kwargs)
|
@@ -322,7 +320,7 @@ def down(**kwargs):
|
|
322
320
|
config = { **kwargs }
|
323
321
|
config['service_name'] = service
|
324
322
|
command = WorkflowRunCommand(app, **config)
|
325
|
-
command.current_working_dir =
|
323
|
+
command.current_working_dir = current_working_dir
|
326
324
|
commands.append(command)
|
327
325
|
|
328
326
|
commands = sorted(commands, key=lambda command: command.service_config.priority)
|
@@ -445,11 +443,14 @@ def logs(**kwargs):
|
|
445
443
|
@click.option('--verbose', is_flag=True)
|
446
444
|
@click.argument('workflow_name')
|
447
445
|
def up(**kwargs):
|
448
|
-
cwd = os.getcwd()
|
449
|
-
|
450
446
|
os.environ[env_vars.LOG_LEVEL] = kwargs['log_level']
|
451
447
|
|
452
|
-
|
448
|
+
from_make = kwargs['from_make']
|
449
|
+
|
450
|
+
# Because we are running a docker-compose command which depends on APP_DIR env var
|
451
|
+
# when we are running this command through make, the host's app_dir_path will likely differ
|
452
|
+
app_dir_path = current_working_dir if from_make else kwargs['app_dir_path']
|
453
|
+
app = App(app_dir_path, DOCKER_NAMESPACE, **kwargs)
|
453
454
|
__validate_app(app)
|
454
455
|
|
455
456
|
# If namespace is set, default network to namespace
|
@@ -469,7 +470,7 @@ def up(**kwargs):
|
|
469
470
|
config = { **kwargs }
|
470
471
|
config['service_name'] = service
|
471
472
|
command = WorkflowRunCommand(app, **config)
|
472
|
-
command.current_working_dir =
|
473
|
+
command.current_working_dir = current_working_dir
|
473
474
|
commands.append(command)
|
474
475
|
|
475
476
|
# Before services can be started, their image and network needs to be created
|
@@ -477,7 +478,7 @@ def up(**kwargs):
|
|
477
478
|
command: WorkflowRunCommand = commands[0]
|
478
479
|
|
479
480
|
init_commands = []
|
480
|
-
if not
|
481
|
+
if not from_make:
|
481
482
|
create_image_command = command.create_image(user_id=kwargs['user_id'], verbose=kwargs['verbose'])
|
482
483
|
init_commands.append(create_image_command)
|
483
484
|
|
@@ -5,7 +5,7 @@ from typing import List
|
|
5
5
|
from stoobly_agent.lib.cache import Cache
|
6
6
|
from stoobly_agent.lib.orm.request import Request
|
7
7
|
|
8
|
-
|
8
|
+
SUFFIX = 'last_request_id'
|
9
9
|
|
10
10
|
def access_request(session_id: str, request_id: int, timeout = None):
|
11
11
|
cache = Cache.instance()
|
@@ -21,7 +21,7 @@ def generate_session_id(query: dict):
|
|
21
21
|
return hashlib.md5(b'.'.join(toks)).hexdigest()
|
22
22
|
|
23
23
|
def reset_sessions():
|
24
|
-
Cache.instance().clear(f"
|
24
|
+
Cache.instance().clear(f".+\\.{SUFFIX}")
|
25
25
|
|
26
26
|
def tiebreak_scenario_request(session_id: str, requests: List[Request]):
|
27
27
|
if len(requests) == 0:
|
@@ -48,4 +48,4 @@ def tiebreak_scenario_request(session_id: str, requests: List[Request]):
|
|
48
48
|
|
49
49
|
def __last_request_id_key(_key = None):
|
50
50
|
_key = _key or generate_session_id()
|
51
|
-
return f"{_key}.{
|
51
|
+
return f"{_key}.{SUFFIX}"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
stoobly_agent/__init__.py,sha256=
|
1
|
+
stoobly_agent/__init__.py,sha256=TpjT1MsvwczXCQiCcj9IYYMVu3xK_HcFzvk6Y9h109w,44
|
2
2
|
stoobly_agent/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
stoobly_agent/app/api/__init__.py,sha256=ctkB8KR-eXO0SFhj602huHiyvQ3PslFWd8fkcufgrAI,1000
|
4
4
|
stoobly_agent/app/api/application_http_request_handler.py,sha256=ZgCfmdr5um-OFAiuRHdBxFqPIeph9WqYkVg-oVQWw-E,5543
|
@@ -73,7 +73,7 @@ stoobly_agent/app/cli/scaffold/app_config.py,sha256=Gs-BynV1vY7_PpTOenn2mqc7lBIu
|
|
73
73
|
stoobly_agent/app/cli/scaffold/app_create_command.py,sha256=sy4017eiir9MK0TEbTi1NyG9mhOGlenGGVnq0GsGUrQ,966
|
74
74
|
stoobly_agent/app/cli/scaffold/command.py,sha256=aoTsdkkBzyu7TkVSMdNQQGk0Gj874jNgFcjR14y3TuM,254
|
75
75
|
stoobly_agent/app/cli/scaffold/config.py,sha256=HZU5tkvr3dkPr4JMXZtrJlu2wxxO-134Em6jReFFcq0,688
|
76
|
-
stoobly_agent/app/cli/scaffold/constants.py,sha256=
|
76
|
+
stoobly_agent/app/cli/scaffold/constants.py,sha256=Vn7TLVmxbiLOb7_wFDE4mlwkcr4vs0ZEgMxhS1ANizA,2084
|
77
77
|
stoobly_agent/app/cli/scaffold/docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
78
78
|
stoobly_agent/app/cli/scaffold/docker/app_builder.py,sha256=7z5pk5JKlRDHx2USxY-WurttLyyUkIVYfl34_u1x9dE,501
|
79
79
|
stoobly_agent/app/cli/scaffold/docker/builder.py,sha256=OE7r8vEdEkW3vwpmIctePiO0S5jvao5zMJNpxc-Yayw,2851
|
@@ -103,8 +103,8 @@ stoobly_agent/app/cli/scaffold/service_workflow.py,sha256=sQ_Edy_wGHKMXpD0DmhnOW
|
|
103
103
|
stoobly_agent/app/cli/scaffold/service_workflow_validate_command.py,sha256=iORyPZEQurgWVxrdMgkdD3VsCz3ar2D15dmyY3RoeKw,9904
|
104
104
|
stoobly_agent/app/cli/scaffold/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
105
105
|
stoobly_agent/app/cli/scaffold/templates/app/.Dockerfile.context,sha256=EVoSqGJH_H7Xw1Ktan5GH2SWaOXIr916NUpptr2hkiA,158
|
106
|
-
stoobly_agent/app/cli/scaffold/templates/app/.Makefile,sha256=
|
107
|
-
stoobly_agent/app/cli/scaffold/templates/app/.docker-compose.base.yml,sha256=
|
106
|
+
stoobly_agent/app/cli/scaffold/templates/app/.Makefile,sha256=JOunQ18rT64lYqYkFb3DVXDxP5m1WCtLgy8aAlGLyLs,7999
|
107
|
+
stoobly_agent/app/cli/scaffold/templates/app/.docker-compose.base.yml,sha256=ieZmXTY0RLKowpP102uSKlfu1sbm0849T-mQz858M80,360
|
108
108
|
stoobly_agent/app/cli/scaffold/templates/app/Makefile,sha256=TEmPG7Bf0KZOnmfsgdzza3UdwcVMmM5Lj1YdLc4cgjA,79
|
109
109
|
stoobly_agent/app/cli/scaffold/templates/app/build/.config.yml,sha256=8Wt8ZZ5irvBYYS44xGrR_EWlZDuXH9kyWmquzsh7s8g,19
|
110
110
|
stoobly_agent/app/cli/scaffold/templates/app/build/.docker-compose.base.yml,sha256=H43dtzQkuwWeeB-XzwQNqdKqwS04Ph_Al8AVCOjxCkQ,420
|
@@ -193,9 +193,9 @@ stoobly_agent/app/cli/scaffold/workflow_copy_command.py,sha256=R9hh5dWVz7vGld7pE
|
|
193
193
|
stoobly_agent/app/cli/scaffold/workflow_create_command.py,sha256=bjNRph9TiOzleDiG6vYAExHWLVLAROBCPt6bPxtAmDo,3408
|
194
194
|
stoobly_agent/app/cli/scaffold/workflow_env.py,sha256=x8V5pJmIiklD3f2q2-qq-CORf4YaXYq_r2JpR2MmSwk,416
|
195
195
|
stoobly_agent/app/cli/scaffold/workflow_log_command.py,sha256=Bke4lMOMxuDUFuAx9nlXHbKgYMO4KAg9ASHvjz4aVWc,1372
|
196
|
-
stoobly_agent/app/cli/scaffold/workflow_run_command.py,sha256=
|
196
|
+
stoobly_agent/app/cli/scaffold/workflow_run_command.py,sha256=08tJIMAU3EasFAnE1hMPOFzMEYNtl4pxneAI3VcRmkg,9822
|
197
197
|
stoobly_agent/app/cli/scaffold/workflow_validate_command.py,sha256=fhHciJXg_u32Wmh8us8LhgQj8D1SxkBADtuBBF4K0FM,4377
|
198
|
-
stoobly_agent/app/cli/scaffold_cli.py,sha256=
|
198
|
+
stoobly_agent/app/cli/scaffold_cli.py,sha256=xELl0zXYen7FkjLkDcb1AJXzIzbj_D519UYeYjYKjuU,26783
|
199
199
|
stoobly_agent/app/cli/scenario_cli.py,sha256=3J1EiJOvunkfWrEkOsanw-XrKkOk78ij_GjBlE9p7CE,8229
|
200
200
|
stoobly_agent/app/cli/snapshot_cli.py,sha256=cpCjxFYBuVwLuq_b2lIUu-5zWqupRlrp4xWgDytirSM,10047
|
201
201
|
stoobly_agent/app/cli/trace_cli.py,sha256=K7E-vx3JUcqEDSWOdIOi_AieKNQz7dBfmRrVvKDkzFI,4605
|
@@ -258,7 +258,7 @@ stoobly_agent/app/models/factories/resource/local_db/helpers/search.py,sha256=A7
|
|
258
258
|
stoobly_agent/app/models/factories/resource/local_db/helpers/snapshot.py,sha256=8GNlt33L4zV8yIkkhmb2iLSMYegSiP91HrPyJkE9daE,733
|
259
259
|
stoobly_agent/app/models/factories/resource/local_db/helpers/snapshot_service.py,sha256=fbqh5J5sMj0n_YFQFei2xhXLrSGU9vNmSX_uifA3U3M,1671
|
260
260
|
stoobly_agent/app/models/factories/resource/local_db/helpers/snapshot_types.py,sha256=1pX0jrg13632g_yv_sF1ABzPR7LY7r2HC9g1a5zR1qI,379
|
261
|
-
stoobly_agent/app/models/factories/resource/local_db/helpers/tiebreak_scenario_request.py,sha256=
|
261
|
+
stoobly_agent/app/models/factories/resource/local_db/helpers/tiebreak_scenario_request.py,sha256=BajElzsTE115hWBT6v67eyNFnrHGz-sU6WBNCzWp7Fg,1237
|
262
262
|
stoobly_agent/app/models/factories/resource/local_db/local_db_adapter.py,sha256=uQ5wQ_n0iM8sjY5mkdqED7w4VUKFKjHQGjez1B6ruyg,384
|
263
263
|
stoobly_agent/app/models/factories/resource/local_db/orm_request_builder.py,sha256=4UjFY26ln2Drlg71R4AKY5vUZYbQ28HYQolJv3SBDqE,1581
|
264
264
|
stoobly_agent/app/models/factories/resource/local_db/query_param_adapter.py,sha256=GutK2RLOPvlCWDsj1PBwJFRNT7EwweQzjObvrA2cIaM,4067
|
@@ -737,8 +737,8 @@ stoobly_agent/test/mock_data/scaffold/docker-compose-local-service.yml,sha256=x7
|
|
737
737
|
stoobly_agent/test/mock_data/scaffold/index.html,sha256=qJwuYajKZ4ihWZrJQ3BNObV5kf1VGnnm_vqlPJzdqLE,258
|
738
738
|
stoobly_agent/test/mock_data/uspto.yaml,sha256=6U5se7C3o-86J4m9xpOk9Npias399f5CbfWzR87WKwE,7835
|
739
739
|
stoobly_agent/test/test_helper.py,sha256=m_oAI7tmRYCNZdKfNqISWhMv3e44tjeYViQ3nTUfnos,1007
|
740
|
-
stoobly_agent-1.5.
|
741
|
-
stoobly_agent-1.5.
|
742
|
-
stoobly_agent-1.5.
|
743
|
-
stoobly_agent-1.5.
|
744
|
-
stoobly_agent-1.5.
|
740
|
+
stoobly_agent-1.5.2.dist-info/LICENSE,sha256=o93sj12cdoEOsTCjPaPFsw3Xq0SXs3pPcY-9reE2sEw,548
|
741
|
+
stoobly_agent-1.5.2.dist-info/METADATA,sha256=h0M6PU0p1COzIMJABfrZtaWjTshuY-Jk2gudZzsj958,3087
|
742
|
+
stoobly_agent-1.5.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
743
|
+
stoobly_agent-1.5.2.dist-info/entry_points.txt,sha256=aq5wix5oC8MDQtmyPGU0xaFrsjJg7WH28NmXh2sc3Z8,56
|
744
|
+
stoobly_agent-1.5.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|