meerschaum 2.3.0rc5__py3-none-any.whl → 2.3.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.
- meerschaum/__init__.py +2 -3
- meerschaum/_internal/arguments/_parse_arguments.py +16 -10
- meerschaum/_internal/arguments/_parser.py +1 -1
- meerschaum/_internal/docs/index.py +265 -8
- meerschaum/actions/__init__.py +21 -11
- meerschaum/actions/restart.py +7 -1
- meerschaum/actions/start.py +3 -4
- meerschaum/api/routes/_jobs.py +9 -2
- meerschaum/config/_default.py +1 -0
- meerschaum/config/_version.py +1 -1
- meerschaum/connectors/__init__.py +1 -2
- meerschaum/connectors/api/_jobs.py +16 -3
- meerschaum/jobs/_Executor.py +8 -2
- meerschaum/jobs/_Job.py +31 -1
- meerschaum/jobs/__init__.py +45 -7
- meerschaum/jobs/{_SystemdExecutor.py → systemd.py} +43 -9
- meerschaum/plugins/_Plugin.py +1 -1
- meerschaum/plugins/__init__.py +2 -1
- meerschaum/utils/daemon/Daemon.py +14 -0
- {meerschaum-2.3.0rc5.dist-info → meerschaum-2.3.2.dist-info}/METADATA +1 -1
- {meerschaum-2.3.0rc5.dist-info → meerschaum-2.3.2.dist-info}/RECORD +27 -28
- meerschaum/jobs/_LocalExecutor.py +0 -88
- {meerschaum-2.3.0rc5.dist-info → meerschaum-2.3.2.dist-info}/LICENSE +0 -0
- {meerschaum-2.3.0rc5.dist-info → meerschaum-2.3.2.dist-info}/NOTICE +0 -0
- {meerschaum-2.3.0rc5.dist-info → meerschaum-2.3.2.dist-info}/WHEEL +0 -0
- {meerschaum-2.3.0rc5.dist-info → meerschaum-2.3.2.dist-info}/entry_points.txt +0 -0
- {meerschaum-2.3.0rc5.dist-info → meerschaum-2.3.2.dist-info}/top_level.txt +0 -0
- {meerschaum-2.3.0rc5.dist-info → meerschaum-2.3.2.dist-info}/zip-safe +0 -0
meerschaum/jobs/_Job.py
CHANGED
@@ -58,6 +58,7 @@ class Job:
|
|
58
58
|
self,
|
59
59
|
name: str,
|
60
60
|
sysargs: Union[List[str], str, None] = None,
|
61
|
+
env: Optional[Dict[str, str]] = None,
|
61
62
|
executor_keys: Optional[str] = None,
|
62
63
|
_properties: Optional[Dict[str, Any]] = None,
|
63
64
|
_rotating_log = None,
|
@@ -78,6 +79,9 @@ class Job:
|
|
78
79
|
sysargs: Union[List[str], str, None], default None
|
79
80
|
The sysargs of the command to be executed, e.g. 'start api'.
|
80
81
|
|
82
|
+
env: Optional[Dict[str, str]], default None
|
83
|
+
If provided, set these environment variables in the job's process.
|
84
|
+
|
81
85
|
executor_keys: Optional[str], default None
|
82
86
|
If provided, execute the job remotely on an API instance, e.g. 'api:main'.
|
83
87
|
|
@@ -139,6 +143,9 @@ class Job:
|
|
139
143
|
if _externally_managed:
|
140
144
|
self._properties_patch.update({'externally_managed': _externally_managed})
|
141
145
|
|
146
|
+
if env:
|
147
|
+
self._properties_patch.update({'env': env})
|
148
|
+
|
142
149
|
daemon_sysargs = (
|
143
150
|
self._daemon.properties.get('target', {}).get('args', [None])[0]
|
144
151
|
if self._daemon is not None
|
@@ -226,7 +233,12 @@ class Job:
|
|
226
233
|
"""
|
227
234
|
if self.executor is not None:
|
228
235
|
if not self.exists(debug=debug):
|
229
|
-
return self.executor.create_job(
|
236
|
+
return self.executor.create_job(
|
237
|
+
self.name,
|
238
|
+
self.sysargs,
|
239
|
+
properties=self.daemon.properties,
|
240
|
+
debug=debug,
|
241
|
+
)
|
230
242
|
return self.executor.start_job(self.name, debug=debug)
|
231
243
|
|
232
244
|
if self.is_running():
|
@@ -882,6 +894,24 @@ class Job:
|
|
882
894
|
self._externally_managed or self._externally_managed_file.exists()
|
883
895
|
)
|
884
896
|
|
897
|
+
@property
|
898
|
+
def env(self) -> Dict[str, str]:
|
899
|
+
"""
|
900
|
+
Return the environment variables to set for the job's process.
|
901
|
+
"""
|
902
|
+
if '_env' in self.__dict__:
|
903
|
+
return self.__dict__['_env']
|
904
|
+
|
905
|
+
_env = self.daemon.properties.get('env', {})
|
906
|
+
default_env = {
|
907
|
+
'PYTHONUNBUFFERED': '1',
|
908
|
+
'LINES': str(get_config('jobs', 'terminal', 'lines')),
|
909
|
+
'COLUMNS': str(get_config('jobs', 'terminal', 'columns')),
|
910
|
+
}
|
911
|
+
self._env = {**default_env, **_env}
|
912
|
+
return self._env
|
913
|
+
|
914
|
+
|
885
915
|
def __str__(self) -> str:
|
886
916
|
sysargs = self.sysargs
|
887
917
|
sysargs_str = shlex.join(sysargs) if sysargs else ''
|
meerschaum/jobs/__init__.py
CHANGED
@@ -16,6 +16,7 @@ from meerschaum.jobs._Executor import Executor
|
|
16
16
|
|
17
17
|
__all__ = (
|
18
18
|
'Job',
|
19
|
+
'systemd',
|
19
20
|
'get_jobs',
|
20
21
|
'get_filtered_jobs',
|
21
22
|
'get_restart_jobs',
|
@@ -23,8 +24,8 @@ __all__ = (
|
|
23
24
|
'get_stopped_jobs',
|
24
25
|
'get_paused_jobs',
|
25
26
|
'get_restart_jobs',
|
26
|
-
'Executor',
|
27
27
|
'make_executor',
|
28
|
+
'Executor',
|
28
29
|
'check_restart_jobs',
|
29
30
|
'start_check_jobs_thread',
|
30
31
|
'stop_check_jobs_thread',
|
@@ -126,6 +127,7 @@ def get_filtered_jobs(
|
|
126
127
|
executor_keys: Optional[str] = None,
|
127
128
|
filter_list: Optional[List[str]] = None,
|
128
129
|
include_hidden: bool = False,
|
130
|
+
combine_local_and_systemd: bool = True,
|
129
131
|
warn: bool = False,
|
130
132
|
debug: bool = False,
|
131
133
|
) -> Dict[str, Job]:
|
@@ -133,7 +135,12 @@ def get_filtered_jobs(
|
|
133
135
|
Return a list of jobs filtered by the user.
|
134
136
|
"""
|
135
137
|
from meerschaum.utils.warnings import warn as _warn
|
136
|
-
jobs = get_jobs(
|
138
|
+
jobs = get_jobs(
|
139
|
+
executor_keys,
|
140
|
+
include_hidden=True,
|
141
|
+
combine_local_and_systemd=combine_local_and_systemd,
|
142
|
+
debug=debug,
|
143
|
+
)
|
137
144
|
if not filter_list:
|
138
145
|
return {
|
139
146
|
name: job
|
@@ -160,13 +167,19 @@ def get_restart_jobs(
|
|
160
167
|
executor_keys: Optional[str] = None,
|
161
168
|
jobs: Optional[Dict[str, Job]] = None,
|
162
169
|
include_hidden: bool = False,
|
170
|
+
combine_local_and_systemd: bool = True,
|
163
171
|
debug: bool = False,
|
164
172
|
) -> Dict[str, Job]:
|
165
173
|
"""
|
166
174
|
Return jobs which were created with `--restart` or `--loop`.
|
167
175
|
"""
|
168
176
|
if jobs is None:
|
169
|
-
jobs = get_jobs(
|
177
|
+
jobs = get_jobs(
|
178
|
+
executor_keys,
|
179
|
+
include_hidden=include_hidden,
|
180
|
+
combine_local_and_systemd=combine_local_and_systemd,
|
181
|
+
debug=debug,
|
182
|
+
)
|
170
183
|
|
171
184
|
return {
|
172
185
|
name: job
|
@@ -179,13 +192,19 @@ def get_running_jobs(
|
|
179
192
|
executor_keys: Optional[str] = None,
|
180
193
|
jobs: Optional[Dict[str, Job]] = None,
|
181
194
|
include_hidden: bool = False,
|
195
|
+
combine_local_and_systemd: bool = True,
|
182
196
|
debug: bool = False,
|
183
197
|
) -> Dict[str, Job]:
|
184
198
|
"""
|
185
199
|
Return a dictionary of running jobs.
|
186
200
|
"""
|
187
201
|
if jobs is None:
|
188
|
-
jobs = get_jobs(
|
202
|
+
jobs = get_jobs(
|
203
|
+
executor_keys,
|
204
|
+
include_hidden=include_hidden,
|
205
|
+
combine_local_and_systemd=combine_local_and_systemd,
|
206
|
+
debug=debug,
|
207
|
+
)
|
189
208
|
|
190
209
|
return {
|
191
210
|
name: job
|
@@ -198,13 +217,19 @@ def get_paused_jobs(
|
|
198
217
|
executor_keys: Optional[str] = None,
|
199
218
|
jobs: Optional[Dict[str, Job]] = None,
|
200
219
|
include_hidden: bool = False,
|
220
|
+
combine_local_and_systemd: bool = True,
|
201
221
|
debug: bool = False,
|
202
222
|
) -> Dict[str, Job]:
|
203
223
|
"""
|
204
224
|
Return a dictionary of paused jobs.
|
205
225
|
"""
|
206
226
|
if jobs is None:
|
207
|
-
jobs = get_jobs(
|
227
|
+
jobs = get_jobs(
|
228
|
+
executor_keys,
|
229
|
+
include_hidden=include_hidden,
|
230
|
+
combine_local_and_systemd=combine_local_and_systemd,
|
231
|
+
debug=debug,
|
232
|
+
)
|
208
233
|
|
209
234
|
return {
|
210
235
|
name: job
|
@@ -217,13 +242,19 @@ def get_stopped_jobs(
|
|
217
242
|
executor_keys: Optional[str] = None,
|
218
243
|
jobs: Optional[Dict[str, Job]] = None,
|
219
244
|
include_hidden: bool = False,
|
245
|
+
combine_local_and_systemd: bool = True,
|
220
246
|
debug: bool = False,
|
221
247
|
) -> Dict[str, Job]:
|
222
248
|
"""
|
223
249
|
Return a dictionary of stopped jobs.
|
224
250
|
"""
|
225
251
|
if jobs is None:
|
226
|
-
jobs = get_jobs(
|
252
|
+
jobs = get_jobs(
|
253
|
+
executor_keys,
|
254
|
+
include_hidden=include_hidden,
|
255
|
+
combine_local_and_systemd=combine_local_and_systemd,
|
256
|
+
debug=debug,
|
257
|
+
)
|
227
258
|
|
228
259
|
return {
|
229
260
|
name: job
|
@@ -273,6 +304,7 @@ def check_restart_jobs(
|
|
273
304
|
jobs = get_jobs(
|
274
305
|
executor_keys,
|
275
306
|
include_hidden=include_hidden,
|
307
|
+
combine_local_and_systemd=False,
|
276
308
|
debug=debug,
|
277
309
|
)
|
278
310
|
|
@@ -384,12 +416,18 @@ def _install_healthcheck_job() -> SuccessTuple:
|
|
384
416
|
"""
|
385
417
|
Install the systemd job which checks local jobs.
|
386
418
|
"""
|
419
|
+
from meerschaum.config import get_config
|
420
|
+
|
421
|
+
enable_healthcheck = get_config('system', 'experimental', 'systemd_healthcheck')
|
422
|
+
if not enable_healthcheck:
|
423
|
+
return False, "Local healthcheck is disabled."
|
424
|
+
|
387
425
|
if get_executor_keys_from_context() != 'systemd':
|
388
426
|
return False, "Not running systemd."
|
389
427
|
|
390
428
|
job = Job(
|
391
429
|
'.local-healthcheck',
|
392
|
-
['restart', 'jobs', '-e', 'local', '--loop'],
|
430
|
+
['restart', 'jobs', '-e', 'local', '--loop', '--min-seconds', '60'],
|
393
431
|
executor_keys='systemd',
|
394
432
|
)
|
395
433
|
return job.start()
|
@@ -129,6 +129,7 @@ class SystemdExecutor(Executor):
|
|
129
129
|
service_logs_path = self.get_service_logs_path(name, debug=debug)
|
130
130
|
socket_path = self.get_socket_path(name, debug=debug)
|
131
131
|
result_path = self.get_result_path(name, debug=debug)
|
132
|
+
job = self.get_hidden_job(name, debug=debug)
|
132
133
|
|
133
134
|
sysargs_str = shlex.join(sysargs)
|
134
135
|
exec_str = f'{sys.executable} -m meerschaum {sysargs_str}'
|
@@ -145,9 +146,11 @@ class SystemdExecutor(Executor):
|
|
145
146
|
STATIC_CONFIG['environment']['systemd_log_path']: service_logs_path.as_posix(),
|
146
147
|
STATIC_CONFIG['environment']['systemd_result_path']: result_path.as_posix(),
|
147
148
|
STATIC_CONFIG['environment']['systemd_stdin_path']: socket_path.as_posix(),
|
148
|
-
'LINES': get_config('jobs', 'terminal', 'lines'),
|
149
|
-
'COLUMNS': get_config('jobs', 'terminal', 'columns'),
|
150
149
|
})
|
150
|
+
|
151
|
+
### Allow for user-defined environment variables.
|
152
|
+
mrsm_env_vars.update(job.env)
|
153
|
+
|
151
154
|
environment_lines = [
|
152
155
|
f"Environment={key}={val}"
|
153
156
|
for key, val in mrsm_env_vars.items()
|
@@ -190,7 +193,13 @@ class SystemdExecutor(Executor):
|
|
190
193
|
)
|
191
194
|
return socket_text
|
192
195
|
|
193
|
-
def get_hidden_job(
|
196
|
+
def get_hidden_job(
|
197
|
+
self,
|
198
|
+
name: str,
|
199
|
+
sysargs: Optional[List[str]] = None,
|
200
|
+
properties: Optional[Dict[str, Any]] = None,
|
201
|
+
debug: bool = False,
|
202
|
+
):
|
194
203
|
"""
|
195
204
|
Return the hidden "sister" job to store a job's parameters.
|
196
205
|
"""
|
@@ -198,13 +207,13 @@ class SystemdExecutor(Executor):
|
|
198
207
|
name,
|
199
208
|
sysargs,
|
200
209
|
executor_keys='local',
|
210
|
+
_properties=properties,
|
201
211
|
_rotating_log=self.get_job_rotating_file(name, debug=debug),
|
202
212
|
_stdin_file=self.get_job_stdin_file(name, debug=debug),
|
203
213
|
_status_hook=partial(self.get_job_status, name),
|
204
214
|
_result_hook=partial(self.get_job_result, name),
|
205
215
|
_externally_managed=True,
|
206
216
|
)
|
207
|
-
job._set_externally_managed()
|
208
217
|
return job
|
209
218
|
|
210
219
|
|
@@ -213,6 +222,7 @@ class SystemdExecutor(Executor):
|
|
213
222
|
Return metadata about a job.
|
214
223
|
"""
|
215
224
|
now = time.perf_counter()
|
225
|
+
|
216
226
|
if '_jobs_metadata' not in self.__dict__:
|
217
227
|
self._jobs_metadata: Dict[str, Any] = {}
|
218
228
|
|
@@ -231,6 +241,7 @@ class SystemdExecutor(Executor):
|
|
231
241
|
'daemon': {
|
232
242
|
'status': self.get_job_status(name, debug=debug),
|
233
243
|
'pid': self.get_job_pid(name, debug=debug),
|
244
|
+
'properties': self.get_job_properties(name, debug=debug),
|
234
245
|
},
|
235
246
|
}
|
236
247
|
self._jobs_metadata[name] = {
|
@@ -245,17 +256,24 @@ class SystemdExecutor(Executor):
|
|
245
256
|
"""
|
246
257
|
from meerschaum.jobs._Job import RESTART_FLAGS
|
247
258
|
sysargs = self.get_job_sysargs(name, debug=debug)
|
259
|
+
if not sysargs:
|
260
|
+
return False
|
261
|
+
|
248
262
|
for flag in RESTART_FLAGS:
|
249
263
|
if flag in sysargs:
|
250
264
|
return True
|
265
|
+
|
251
266
|
return False
|
252
267
|
|
253
268
|
def get_job_properties(self, name: str, debug: bool = False) -> Dict[str, Any]:
|
254
269
|
"""
|
255
270
|
Return the properties for a job.
|
256
271
|
"""
|
257
|
-
|
258
|
-
return
|
272
|
+
job = self.get_hidden_job(name, debug=debug)
|
273
|
+
return {
|
274
|
+
k: v for k, v in job.daemon.properties.items()
|
275
|
+
if k != 'externally_managed'
|
276
|
+
}
|
259
277
|
|
260
278
|
def get_job_process(self, name: str, debug: bool = False):
|
261
279
|
"""
|
@@ -499,7 +517,13 @@ class SystemdExecutor(Executor):
|
|
499
517
|
|
500
518
|
return self._stdin_files[name]
|
501
519
|
|
502
|
-
def create_job(
|
520
|
+
def create_job(
|
521
|
+
self,
|
522
|
+
name: str,
|
523
|
+
sysargs: List[str],
|
524
|
+
properties: Optional[Dict[str, Any]] = None,
|
525
|
+
debug: bool = False,
|
526
|
+
) -> SuccessTuple:
|
503
527
|
"""
|
504
528
|
Create a job as a service to be run by `systemd`.
|
505
529
|
"""
|
@@ -510,8 +534,18 @@ class SystemdExecutor(Executor):
|
|
510
534
|
socket_stdin = self.get_job_stdin_file(name, debug=debug)
|
511
535
|
_ = socket_stdin.file_handler
|
512
536
|
|
513
|
-
### Init the
|
514
|
-
|
537
|
+
### Init the externally_managed file.
|
538
|
+
### NOTE: We must write the pickle file in addition to the properties file.
|
539
|
+
job = self.get_hidden_job(name, sysargs=sysargs, properties=properties, debug=debug)
|
540
|
+
job._set_externally_managed()
|
541
|
+
pickle_success, pickle_msg = job.daemon.write_pickle()
|
542
|
+
if not pickle_success:
|
543
|
+
return pickle_success, pickle_msg
|
544
|
+
properties_success, properties_msg = job.daemon.write_properties()
|
545
|
+
if not properties_success:
|
546
|
+
return properties_success, properties_msg
|
547
|
+
|
548
|
+
service_file_path.parent.mkdir(parents=True, exist_ok=True)
|
515
549
|
|
516
550
|
with open(service_file_path, 'w+', encoding='utf-8') as f:
|
517
551
|
f.write(self.get_service_file_text(name, sysargs, debug=debug))
|
meerschaum/plugins/_Plugin.py
CHANGED
@@ -654,7 +654,7 @@ class Plugin:
|
|
654
654
|
import ast, re
|
655
655
|
### NOTE: This technically would break
|
656
656
|
### if `required` was the very first line of the file.
|
657
|
-
req_start_match = re.search(r'
|
657
|
+
req_start_match = re.search(r'\nrequired(:\s*)?.*=', text)
|
658
658
|
if not req_start_match:
|
659
659
|
return []
|
660
660
|
req_start = req_start_match.start()
|
meerschaum/plugins/__init__.py
CHANGED
@@ -28,7 +28,8 @@ _locks = {
|
|
28
28
|
'PLUGINS_INTERNAL_LOCK_PATH': RLock(),
|
29
29
|
}
|
30
30
|
__all__ = (
|
31
|
-
"Plugin", "make_action", "api_plugin", "dash_plugin", "
|
31
|
+
"Plugin", "make_action", "api_plugin", "dash_plugin", "web_page",
|
32
|
+
"import_plugins", "from_plugin_import",
|
32
33
|
"reload_plugins", "get_plugins", "get_data_plugins", "add_plugin_argument",
|
33
34
|
"pre_sync_hook", "post_sync_hook",
|
34
35
|
)
|
@@ -141,6 +141,7 @@ class Daemon:
|
|
141
141
|
target: Optional[Callable[[Any], Any]] = None,
|
142
142
|
target_args: Union[List[Any], Tuple[Any], None] = None,
|
143
143
|
target_kw: Optional[Dict[str, Any]] = None,
|
144
|
+
env: Optional[Dict[str, str]] = None,
|
144
145
|
daemon_id: Optional[str] = None,
|
145
146
|
label: Optional[str] = None,
|
146
147
|
properties: Optional[Dict[str, Any]] = None,
|
@@ -157,6 +158,9 @@ class Daemon:
|
|
157
158
|
target_kw: Optional[Dict[str, Any]], default None
|
158
159
|
Keyword arguments to pass to the target function.
|
159
160
|
|
161
|
+
env: Optional[Dict[str, str]], default None
|
162
|
+
If provided, set these environment variables in the daemon process.
|
163
|
+
|
160
164
|
daemon_id: Optional[str], default None
|
161
165
|
Build a `Daemon` from an existing `daemon_id`.
|
162
166
|
If `daemon_id` is provided, other arguments are ignored and are derived
|
@@ -227,7 +231,11 @@ class Daemon:
|
|
227
231
|
self._properties = properties
|
228
232
|
if self._properties is None:
|
229
233
|
self._properties = {}
|
234
|
+
|
230
235
|
self._properties.update({'label': self.label})
|
236
|
+
if env:
|
237
|
+
self._properties.update({'env': env})
|
238
|
+
|
231
239
|
### Instantiate the process and if it doesn't exist, make sure the PID is removed.
|
232
240
|
_ = self.process
|
233
241
|
|
@@ -295,6 +303,12 @@ class Daemon:
|
|
295
303
|
sys.stdin = self.stdin_file
|
296
304
|
os.environ[STATIC_CONFIG['environment']['daemon_id']] = self.daemon_id
|
297
305
|
os.environ['PYTHONUNBUFFERED'] = '1'
|
306
|
+
|
307
|
+
### Allow the user to override environment variables.
|
308
|
+
env = self.properties.get('env', {})
|
309
|
+
if env and isinstance(env, dict):
|
310
|
+
os.environ.update({str(k): str(v) for k, v in env.items()})
|
311
|
+
|
298
312
|
self.rotating_log.refresh_files(start_interception=True)
|
299
313
|
result = None
|
300
314
|
try:
|
@@ -1,12 +1,12 @@
|
|
1
|
-
meerschaum/__init__.py,sha256=
|
1
|
+
meerschaum/__init__.py,sha256=6bn5zz7VInDP4fE_FGBMzJYrM6rQhBMJNQqsf1pU7eI,1701
|
2
2
|
meerschaum/__main__.py,sha256=r5UjYxH1WA6dGG9YGBPul5xOdgF3Iwl0X4dWDtXU-30,2646
|
3
3
|
meerschaum/_internal/__init__.py,sha256=ilC7utfKtin7GAvuN34fKyUQYfPyqH0Mm3MJF5iyEf4,169
|
4
4
|
meerschaum/_internal/entry.py,sha256=psQ6zltjBk-9663jT_JiYq34qr6Izk7oLoLCBayYjK8,10125
|
5
5
|
meerschaum/_internal/arguments/__init__.py,sha256=CbNgnlH6fqNI5n7EuQC6m3Do6ckXDqw4Vuc4T_qPJGQ,566
|
6
|
-
meerschaum/_internal/arguments/_parse_arguments.py,sha256=
|
7
|
-
meerschaum/_internal/arguments/_parser.py,sha256=
|
6
|
+
meerschaum/_internal/arguments/_parse_arguments.py,sha256=6Tf9xTXZA-wH51Ep_iuG5JFLzD2rYevuA8n69FTi6Mk,12984
|
7
|
+
meerschaum/_internal/arguments/_parser.py,sha256=LfiVDTr1akj5D31qpJAAXKxMcnLQiD3jRpZtvvHWrAo,14917
|
8
8
|
meerschaum/_internal/docs/__init__.py,sha256=ZQYHWo6n0kfLLkyG36YXqTYvv2Pc7it5HZHMylT6cBA,126
|
9
|
-
meerschaum/_internal/docs/index.py,sha256=
|
9
|
+
meerschaum/_internal/docs/index.py,sha256=LwpPMX5ODsv-CSLOmwKhJpYdEK4LBrZ260yJhYwN0L8,24389
|
10
10
|
meerschaum/_internal/gui/__init__.py,sha256=KF6Opae0aBOjIndMZ2txoPs7ozCXRlR-lcTsicLO7fc,1313
|
11
11
|
meerschaum/_internal/gui/app/__init__.py,sha256=rKUa8hHk6Fai-PDF61tQcpT1myxKcfmvEMDHxThNp7o,1565
|
12
12
|
meerschaum/_internal/gui/app/_windows.py,sha256=-VHdjTzA3V596fVqnbmTxemONSp_80-sTNJ0CTB8FwU,2632
|
@@ -21,7 +21,7 @@ meerschaum/_internal/shell/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
|
|
21
21
|
meerschaum/_internal/term/TermPageHandler.py,sha256=Rt5S47Pr_3HLJc8xIXpZUczYE_Dw2qT8qwf1jZFtUHQ,520
|
22
22
|
meerschaum/_internal/term/__init__.py,sha256=eXjfRzpnASWomB4xpY2AfzC_CLenkInNnVWSLZEexlg,1638
|
23
23
|
meerschaum/_internal/term/tools.py,sha256=dXVAimKD-Yv2fg2WOTr0YGBY7XDKjQqw-RizcS65YVI,727
|
24
|
-
meerschaum/actions/__init__.py,sha256=
|
24
|
+
meerschaum/actions/__init__.py,sha256=MHPs8aRBhbZQXnqd_6tVtisTrNCgPAPgnNcXYbn0zP8,11640
|
25
25
|
meerschaum/actions/api.py,sha256=8wjREHNRkl8WBgtz1KfWmAVjeFR_J2j7ghXjSyYUW3g,12603
|
26
26
|
meerschaum/actions/attach.py,sha256=UV19d9W_2WYcrf7BRz7k3mriDoX1V4rA4AKvbLdor0o,3106
|
27
27
|
meerschaum/actions/bootstrap.py,sha256=9D3cBHzgZbZyWy-Y7iQgk9bpTbKEhumFKbIIThZgPXI,14058
|
@@ -38,13 +38,13 @@ meerschaum/actions/pause.py,sha256=WI4dQFfjQ6ObWKUzwQ5FrtYPDyEcnxWwval8cSIzzJw,4
|
|
38
38
|
meerschaum/actions/python.py,sha256=aoSaDSIQ-wJixexFDtsxBMqITktba3DLkJNFIra_6qk,4546
|
39
39
|
meerschaum/actions/register.py,sha256=bOQY0AlZlchsxPF27LL7G1OgdiCyj7mkBaD-PO6bFZc,14491
|
40
40
|
meerschaum/actions/reload.py,sha256=gMXeFBGVfyQ7uhKhYf6bLaDMD0fLPcA9BrLBSiuvWIc,508
|
41
|
-
meerschaum/actions/restart.py,sha256=
|
41
|
+
meerschaum/actions/restart.py,sha256=6ffp3-X9eTEgunVSdD41HnOwqp71yjuSAmXJ5j39ONI,3038
|
42
42
|
meerschaum/actions/setup.py,sha256=KkAGWcgwzl_L6A19fTmTX1KtBjW2FwD8QenLjPy0mQQ,3205
|
43
43
|
meerschaum/actions/sh.py,sha256=fLfTJaacKu4sjLTRqEzzYlT2WbbdZBEczsKb6F-qAek,2026
|
44
44
|
meerschaum/actions/show.py,sha256=Ij6v5so9GHUrYVi7AhPfhHGjABBofXTPAljLFa2xuWA,28141
|
45
45
|
meerschaum/actions/sql.py,sha256=wYofwk1vGO96U2ncigGEfMtYMZeprz2FR1PRRZhkAPI,4311
|
46
46
|
meerschaum/actions/stack.py,sha256=7ODAxzmCx8i9AHxvkbr5ZtzUNPpY-iqlSVo4rZHMOw4,5900
|
47
|
-
meerschaum/actions/start.py,sha256=
|
47
|
+
meerschaum/actions/start.py,sha256=R3ooagL5VazTrC2yOSjakROSC3FoYT1NYhmWF1gsbFo,19262
|
48
48
|
meerschaum/actions/stop.py,sha256=5fdUw70YN-yuUWrC-NhA88cxr9FZ5NbssbQ8xXO8nFU,4632
|
49
49
|
meerschaum/actions/sync.py,sha256=AkH-1O5bkUC-UElQGr0lRhrX-z18ZY2nBPSy9EsW1Kc,17506
|
50
50
|
meerschaum/actions/tag.py,sha256=SJf5qFW0ccLXjqlTdkK_0MCcrCMdg6xhYrhKdco0hdA,3053
|
@@ -118,7 +118,7 @@ meerschaum/api/routes/__init__.py,sha256=jbkeFNl51Tg8aT5gWe560ZLZLojFJsLMe5IENRj
|
|
118
118
|
meerschaum/api/routes/_actions.py,sha256=J_d0jcBZbVDLfzqjR7Ar58oflA-dRQ2oCFYpvk5HHRE,6201
|
119
119
|
meerschaum/api/routes/_connectors.py,sha256=NNbcn5xWhKqw2PqueSEaqRaZ95hFGDKazG5lE7gsssc,1849
|
120
120
|
meerschaum/api/routes/_index.py,sha256=QI6CBo6pI2Zi0a6fJHDjZfiLa9f4okb0BGe3A_JD0kM,578
|
121
|
-
meerschaum/api/routes/_jobs.py,sha256=
|
121
|
+
meerschaum/api/routes/_jobs.py,sha256=gmbgz_yqJB8K6nJVrzzPCnGRC5Kh6g5iiVGLNvZjUQM,11222
|
122
122
|
meerschaum/api/routes/_login.py,sha256=psPKmFkXgYVX83NepqwIhaLsQ5uWgOc4F2QZtPGxY1A,2482
|
123
123
|
meerschaum/api/routes/_misc.py,sha256=05--9ZVFeaCgZrHER2kA3SYdK4TyfkEXOCjLvPbum-w,2469
|
124
124
|
meerschaum/api/routes/_pipes.py,sha256=1gBuE4E-QvIK_kmbmiw7uLcXjnIobFI1t4tb2skpp6E,21592
|
@@ -129,7 +129,7 @@ meerschaum/api/routes/_webterm.py,sha256=7eilgDXckpEc2LyeNmJS5YO6HxlyMkwPnAMWd7e
|
|
129
129
|
meerschaum/api/tables/__init__.py,sha256=e2aNC0CdlWICTUMx1i9RauF8Pm426J0RZJbsJWv4SWo,482
|
130
130
|
meerschaum/config/__init__.py,sha256=jZgQSjvbOWyvGouqRgIeYBg9Pp343_9CDsCWWpwYDGY,11577
|
131
131
|
meerschaum/config/_dash.py,sha256=BJHl4xMrQB-YHUEU7ldEW8q_nOPoIRSOqLrfGElc6Dw,187
|
132
|
-
meerschaum/config/_default.py,sha256=
|
132
|
+
meerschaum/config/_default.py,sha256=SsS80gbxoiYnrmgzpgqmOJIvy0ubT-GI7PpH04UEMv4,5349
|
133
133
|
meerschaum/config/_edit.py,sha256=_kabgFbJdI5kcLs-JIsoaTo0JdyxnPnBdrlTyTAgPm8,8236
|
134
134
|
meerschaum/config/_environment.py,sha256=Vv4DLDfc2vKLbCLsMvkQDj77K4kEvHKEBmUBo-wCrgo,4419
|
135
135
|
meerschaum/config/_formatting.py,sha256=OMuqS1EWOsj_34wSs2tOqGIWci3bTMIZ5l-uelZgsIM,6672
|
@@ -140,7 +140,7 @@ meerschaum/config/_preprocess.py,sha256=-AEA8m_--KivZwTQ1sWN6LTn5sio_fUr2XZ51BO6
|
|
140
140
|
meerschaum/config/_read_config.py,sha256=WFZKIXZMDe_ca0ES7ivgM_mnwShvFxLdoeisT_X5-h0,14720
|
141
141
|
meerschaum/config/_shell.py,sha256=46_m49Txc5q1rGfCgO49ca48BODx45DQJi8D0zz1R18,4245
|
142
142
|
meerschaum/config/_sync.py,sha256=oK2ZujO2T1he08BXCFyiniBUevNGWSQKXLcS_jRv_7Y,4155
|
143
|
-
meerschaum/config/_version.py,sha256=
|
143
|
+
meerschaum/config/_version.py,sha256=FngJT1BF6959BwyIxw5aYINdEHg4LRf7Wpv2OjrU3nE,71
|
144
144
|
meerschaum/config/paths.py,sha256=JjibeGN3YAdSNceRwsd42aNmeUrIgM6ndzC8qZAmNI0,621
|
145
145
|
meerschaum/config/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
146
146
|
meerschaum/config/stack/__init__.py,sha256=Yt7GNzC_hz7iUDZ4gVho_lugJO2DnXgnMtsMG_ReoRg,9114
|
@@ -150,14 +150,14 @@ meerschaum/config/stack/mosquitto/resources/__init__.py,sha256=47DEQpj8HBSa-_TIm
|
|
150
150
|
meerschaum/config/stack/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
151
151
|
meerschaum/config/static/__init__.py,sha256=bSugcNkYKnApqUxT0LcpqE_3-2tyJfTu2fDmzbB4fVM,5127
|
152
152
|
meerschaum/connectors/Connector.py,sha256=utNV3Fy5DhUVbQE-vtm7enH5rH2gxQERmgmP7PUzH30,6682
|
153
|
-
meerschaum/connectors/__init__.py,sha256=
|
153
|
+
meerschaum/connectors/__init__.py,sha256=fLoatCZV2hsDffYEg2aBzqPLzM_2o1_Z3X2iZvLwoqA,12503
|
154
154
|
meerschaum/connectors/parse.py,sha256=sDeI2OIS9Inwhbn9jkFAXxOPnmmAHqsuHiiHfWjVnSA,4307
|
155
155
|
meerschaum/connectors/poll.py,sha256=gIY9TvFBqMvMNQvR0O2No7koLLz2PjfExBr_Dsosgpg,7363
|
156
156
|
meerschaum/connectors/api/APIConnector.py,sha256=MPYeImCBAeSpueYis5CxkfT7kkV82MnGKDLoNE8uOVw,5017
|
157
157
|
meerschaum/connectors/api/__init__.py,sha256=JwKrGtuE5aOd2VnsRwudFBYyBf5IxczOwPVdNvCUgSQ,205
|
158
158
|
meerschaum/connectors/api/_actions.py,sha256=Vg_ugl02MUjYtfyx0o9jt5ZoluNC0J1R-UEIRlcIpMI,4701
|
159
159
|
meerschaum/connectors/api/_fetch.py,sha256=Khq9AFr1nk8Dsmcedb77aWhAuHw0JGgVeahDG95Q5MQ,2072
|
160
|
-
meerschaum/connectors/api/_jobs.py,sha256=
|
160
|
+
meerschaum/connectors/api/_jobs.py,sha256=bPQpnacqiJwXxrMEDgsv63Dn6KRprTvDqdeEmpZhkFw,11249
|
161
161
|
meerschaum/connectors/api/_login.py,sha256=5GsD-B214vr5EYfM3XrTUs1sTFApxZA-9dNxq8oNSyg,2050
|
162
162
|
meerschaum/connectors/api/_misc.py,sha256=OZRZBYOokKIEjmQaR8jUYgu6ZRn9VzXBChzR8CfDv_w,1092
|
163
163
|
meerschaum/connectors/api/_pipes.py,sha256=Nnc-IShiTkCia548dePymKosQCcl2InFCyUX3Q-Xx6Q,20604
|
@@ -200,13 +200,12 @@ meerschaum/core/Pipe/_verify.py,sha256=KSnthUzImRLjt9fxyBaLvArqDuOLRpKBfk0tnseJC
|
|
200
200
|
meerschaum/core/Plugin/__init__.py,sha256=UXg64EvJPgI1PCxkY_KM02-ZmBm4FZpLPIQR_uSJJDc,137
|
201
201
|
meerschaum/core/User/_User.py,sha256=CApB7Y0QJL6S9QOCCfrG4SbPuPXJ9AsAYQ5pASMP_Aw,6527
|
202
202
|
meerschaum/core/User/__init__.py,sha256=lJ7beIZTG9sO4dAi3367fFBl17dXYEWHKi7HoaPlDyk,193
|
203
|
-
meerschaum/jobs/_Executor.py,sha256=
|
204
|
-
meerschaum/jobs/_Job.py,sha256=
|
205
|
-
meerschaum/jobs/
|
206
|
-
meerschaum/jobs/
|
207
|
-
meerschaum/
|
208
|
-
meerschaum/plugins/
|
209
|
-
meerschaum/plugins/__init__.py,sha256=3Hg9yyfkN0TxPPTnlt6pi53znjRIAR92WpG3zEKYm10,26152
|
203
|
+
meerschaum/jobs/_Executor.py,sha256=qM62BhFTM4tyJ7p90KOM0y3qyeRY9k3ZV_aTDJMHnO8,1682
|
204
|
+
meerschaum/jobs/_Job.py,sha256=leyW98wPQUJwvF68zL4vSScalpy6v-e9CiDynoI6aPk,31056
|
205
|
+
meerschaum/jobs/__init__.py,sha256=iM-2rEqxVMVZxwYQYsMPDx1wpJs9Lb4xQcguKCI6okU,11899
|
206
|
+
meerschaum/jobs/systemd.py,sha256=H1hdUh7QJs-DSZ7-jEYZ0NLNEplWmyFo2zt2LAsZO9M,24147
|
207
|
+
meerschaum/plugins/_Plugin.py,sha256=p6j39tm-xrZENBq-eGtixBuXxLLddtEKWRCRFNqpRu0,34086
|
208
|
+
meerschaum/plugins/__init__.py,sha256=trMQ53qgP7ikJhhV_uXzqJw6X1NDz2rPOGXFk40bb1Y,26190
|
210
209
|
meerschaum/plugins/bootstrap.py,sha256=qg9MQ1YAU8ShwGqWDl38WjiXLIxDPl95pSIGDLN9rOw,11423
|
211
210
|
meerschaum/utils/__init__.py,sha256=QrK1K9hIbPCRCM5k2nZGFqGnrqhA0Eh-iSmCU7FG6Cs,612
|
212
211
|
meerschaum/utils/_get_pipes.py,sha256=dlPckpYYyM0IwRZ2VL0u9DiEeYhr5Ho9gkzvWxzNVwI,11460
|
@@ -224,7 +223,7 @@ meerschaum/utils/threading.py,sha256=3N8JXPAnwqJiSjuQcbbJg3Rv9-CCUMJpeQRfKFR7MaA
|
|
224
223
|
meerschaum/utils/typing.py,sha256=U3MC347sh1umpa3Xr1k71eADyDmk4LB6TnVCpq8dVzI,2830
|
225
224
|
meerschaum/utils/warnings.py,sha256=IDiwYspsfjIi1gtk3V9cSo9vNLckB9bCsHhRClpPJTc,6639
|
226
225
|
meerschaum/utils/yaml.py,sha256=Da9ZtNdT8f68sqz6g4eLQM3jz8QQ2J9_FglX-fw5VXY,3901
|
227
|
-
meerschaum/utils/daemon/Daemon.py,sha256=
|
226
|
+
meerschaum/utils/daemon/Daemon.py,sha256=rLUjJTGwKVUGVTHyz_A_lUJ_Wb2CgzT1ZFLhLwvGiNk,42142
|
228
227
|
meerschaum/utils/daemon/FileDescriptorInterceptor.py,sha256=MJKMO0Syf3d8yWUs6xXcQzg8Ptsuvh2aCRRoglOjusA,5257
|
229
228
|
meerschaum/utils/daemon/RotatingFile.py,sha256=ePm_svjwyFDWh6V1k-bp1RHXCSWlyxDtlFu4SU4XvPU,24369
|
230
229
|
meerschaum/utils/daemon/StdinFile.py,sha256=J6tyUReM8NEp3bBQAxMfe8mjJG5mWi6CzHN4x86VQBI,3237
|
@@ -242,11 +241,11 @@ meerschaum/utils/packages/_packages.py,sha256=GzbJ0kxW_EQogXmY4vguRkUyad42cshFs7
|
|
242
241
|
meerschaum/utils/packages/lazy_loader.py,sha256=VHnph3VozH29R4JnSSBfwtA5WKZYZQFT_GeQSShCnuc,2540
|
243
242
|
meerschaum/utils/venv/_Venv.py,sha256=sBnlmxHdAh2bx8btfVoD79-H9-cYsv5lP02IIXkyECs,3553
|
244
243
|
meerschaum/utils/venv/__init__.py,sha256=bLAWnllKDuE_z6bLk7gLh4mI3Sp1j5hsboTqPKOQq84,24361
|
245
|
-
meerschaum-2.3.
|
246
|
-
meerschaum-2.3.
|
247
|
-
meerschaum-2.3.
|
248
|
-
meerschaum-2.3.
|
249
|
-
meerschaum-2.3.
|
250
|
-
meerschaum-2.3.
|
251
|
-
meerschaum-2.3.
|
252
|
-
meerschaum-2.3.
|
244
|
+
meerschaum-2.3.2.dist-info/LICENSE,sha256=jG2zQEdRNt88EgHUWPpXVWmOrOduUQRx7MnYV9YIPaw,11359
|
245
|
+
meerschaum-2.3.2.dist-info/METADATA,sha256=eHBptbYlyLDmNHOsptNJbIO2MrmtPUAXw3YxEhtUD6U,24006
|
246
|
+
meerschaum-2.3.2.dist-info/NOTICE,sha256=OTA9Fcthjf5BRvWDDIcBC_xfLpeDV-RPZh3M-HQBRtQ,114
|
247
|
+
meerschaum-2.3.2.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
248
|
+
meerschaum-2.3.2.dist-info/entry_points.txt,sha256=5YBVzibw-0rNA_1VjB16z5GABsOGf-CDhW4yqH8C7Gc,88
|
249
|
+
meerschaum-2.3.2.dist-info/top_level.txt,sha256=bNoSiDj0El6buocix-FRoAtJOeq1qOF5rRm2u9i7Q6A,11
|
250
|
+
meerschaum-2.3.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
251
|
+
meerschaum-2.3.2.dist-info/RECORD,,
|
@@ -1,88 +0,0 @@
|
|
1
|
-
#! /usr/bin/env python3
|
2
|
-
# vim:fenc=utf-8
|
3
|
-
|
4
|
-
"""
|
5
|
-
Run jobs locally.
|
6
|
-
"""
|
7
|
-
|
8
|
-
from meerschaum.utils.typing import Dict, Any, List, SuccessTuple, Union
|
9
|
-
from meerschaum.jobs import Job, Executor, make_executor
|
10
|
-
from meerschaum.utils.daemon import Daemon, get_daemons
|
11
|
-
from meerschaum._internal.entry import entry
|
12
|
-
|
13
|
-
|
14
|
-
@make_executor
|
15
|
-
class LocalExecutor(Executor):
|
16
|
-
"""
|
17
|
-
Run jobs locally as Unix daemons.
|
18
|
-
"""
|
19
|
-
|
20
|
-
def get_job_daemon(
|
21
|
-
self,
|
22
|
-
name: str,
|
23
|
-
# sysargs: Opt
|
24
|
-
debug: bool = False,
|
25
|
-
) -> Union[Daemon, None]:
|
26
|
-
"""
|
27
|
-
Return a job's daemon if it exists.
|
28
|
-
"""
|
29
|
-
try:
|
30
|
-
daemon = Daemon(name)
|
31
|
-
except Exception:
|
32
|
-
daemon = None
|
33
|
-
|
34
|
-
return daemon
|
35
|
-
|
36
|
-
def get_daemon_syargs(self, name: str, debug: bool = False) -> Union[List[str], None]:
|
37
|
-
"""
|
38
|
-
Return the list of sysargs from the job's daemon.
|
39
|
-
"""
|
40
|
-
daemon = self.get_job_daemon(name, debug=debug)
|
41
|
-
|
42
|
-
if daemon is None:
|
43
|
-
return None
|
44
|
-
|
45
|
-
return daemon.properties.get('target', {}).get('args', [None])[0]
|
46
|
-
|
47
|
-
def get_job_exists(self, name: str, debug: bool = False) -> bool:
|
48
|
-
"""
|
49
|
-
Return whether a job exists.
|
50
|
-
"""
|
51
|
-
daemon = self.get_job_daemon(name, debug=debug)
|
52
|
-
if daemon is None:
|
53
|
-
return False
|
54
|
-
|
55
|
-
def get_jobs(self) -> Dict[str, Job]:
|
56
|
-
"""
|
57
|
-
Return a dictionary of names -> Jobs.
|
58
|
-
"""
|
59
|
-
|
60
|
-
def create_job(self, name: str, sysargs: List[str], debug: bool = False) -> SuccessTuple:
|
61
|
-
"""
|
62
|
-
Create a new job.
|
63
|
-
"""
|
64
|
-
|
65
|
-
def start_job(self, name: str, debug: bool = False) -> SuccessTuple:
|
66
|
-
"""
|
67
|
-
Start a job.
|
68
|
-
"""
|
69
|
-
|
70
|
-
def stop_job(self, name: str, debug: bool = False) -> SuccessTuple:
|
71
|
-
"""
|
72
|
-
Stop a job.
|
73
|
-
"""
|
74
|
-
|
75
|
-
def pause_job(self, name: str, debug: bool = False) -> SuccessTuple:
|
76
|
-
"""
|
77
|
-
Pause a job.
|
78
|
-
"""
|
79
|
-
|
80
|
-
def delete_job(self, name: str, debug: bool = False) -> SuccessTuple:
|
81
|
-
"""
|
82
|
-
Delete a job.
|
83
|
-
"""
|
84
|
-
|
85
|
-
def get_logs(self, name: str, debug: bool = False) -> str:
|
86
|
-
"""
|
87
|
-
Return a job's log output.
|
88
|
-
"""
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|