meerschaum 2.2.7__py3-none-any.whl → 2.3.0.dev3__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.
Files changed (52) hide show
  1. meerschaum/__init__.py +6 -1
  2. meerschaum/_internal/arguments/_parse_arguments.py +10 -3
  3. meerschaum/_internal/arguments/_parser.py +44 -15
  4. meerschaum/_internal/entry.py +22 -1
  5. meerschaum/_internal/shell/Shell.py +129 -31
  6. meerschaum/actions/__init__.py +8 -6
  7. meerschaum/actions/api.py +12 -12
  8. meerschaum/actions/attach.py +108 -0
  9. meerschaum/actions/delete.py +35 -26
  10. meerschaum/actions/show.py +119 -148
  11. meerschaum/actions/start.py +85 -75
  12. meerschaum/actions/stop.py +68 -39
  13. meerschaum/api/_events.py +18 -1
  14. meerschaum/api/_oauth2.py +2 -0
  15. meerschaum/api/_websockets.py +2 -2
  16. meerschaum/api/dash/jobs.py +5 -2
  17. meerschaum/api/routes/__init__.py +1 -0
  18. meerschaum/api/routes/_actions.py +122 -44
  19. meerschaum/api/routes/_jobs.py +371 -0
  20. meerschaum/api/routes/_pipes.py +5 -5
  21. meerschaum/config/_default.py +1 -0
  22. meerschaum/config/_paths.py +1 -0
  23. meerschaum/config/_shell.py +8 -3
  24. meerschaum/config/_version.py +1 -1
  25. meerschaum/config/static/__init__.py +10 -0
  26. meerschaum/connectors/__init__.py +9 -11
  27. meerschaum/connectors/api/APIConnector.py +18 -1
  28. meerschaum/connectors/api/_actions.py +60 -71
  29. meerschaum/connectors/api/_jobs.py +330 -0
  30. meerschaum/connectors/parse.py +23 -7
  31. meerschaum/plugins/__init__.py +89 -5
  32. meerschaum/utils/daemon/Daemon.py +255 -30
  33. meerschaum/utils/daemon/FileDescriptorInterceptor.py +5 -5
  34. meerschaum/utils/daemon/RotatingFile.py +10 -6
  35. meerschaum/utils/daemon/StdinFile.py +110 -0
  36. meerschaum/utils/daemon/__init__.py +13 -7
  37. meerschaum/utils/formatting/__init__.py +2 -1
  38. meerschaum/utils/formatting/_jobs.py +83 -54
  39. meerschaum/utils/formatting/_shell.py +6 -0
  40. meerschaum/utils/jobs/_Job.py +710 -0
  41. meerschaum/utils/jobs/__init__.py +245 -0
  42. meerschaum/utils/misc.py +18 -17
  43. meerschaum/utils/packages/_packages.py +2 -2
  44. meerschaum/utils/prompt.py +16 -8
  45. {meerschaum-2.2.7.dist-info → meerschaum-2.3.0.dev3.dist-info}/METADATA +9 -9
  46. {meerschaum-2.2.7.dist-info → meerschaum-2.3.0.dev3.dist-info}/RECORD +52 -46
  47. {meerschaum-2.2.7.dist-info → meerschaum-2.3.0.dev3.dist-info}/WHEEL +1 -1
  48. {meerschaum-2.2.7.dist-info → meerschaum-2.3.0.dev3.dist-info}/LICENSE +0 -0
  49. {meerschaum-2.2.7.dist-info → meerschaum-2.3.0.dev3.dist-info}/NOTICE +0 -0
  50. {meerschaum-2.2.7.dist-info → meerschaum-2.3.0.dev3.dist-info}/entry_points.txt +0 -0
  51. {meerschaum-2.2.7.dist-info → meerschaum-2.3.0.dev3.dist-info}/top_level.txt +0 -0
  52. {meerschaum-2.2.7.dist-info → meerschaum-2.3.0.dev3.dist-info}/zip-safe +0 -0
@@ -7,65 +7,143 @@ Execute Meerschaum Actions via the API
7
7
  """
8
8
 
9
9
  from __future__ import annotations
10
- from meerschaum.utils.typing import SuccessTuple, Union
10
+ import asyncio
11
+ import traceback
12
+ import shlex
13
+ from functools import partial
14
+ from datetime import datetime, timezone
11
15
 
16
+ from fastapi import WebSocket, WebSocketDisconnect
17
+
18
+ from meerschaum.utils.misc import generate_password
19
+ from meerschaum.utils.jobs import Job
20
+ from meerschaum.utils.warnings import warn
21
+ from meerschaum.utils.typing import SuccessTuple, Union, List, Dict
12
22
  from meerschaum.api import (
13
23
  fastapi, app, endpoints, get_api_connector, debug, manager, private, no_auth
14
24
  )
15
25
  from meerschaum.actions import actions
16
26
  import meerschaum.core
27
+ from meerschaum.config import get_config
28
+ from meerschaum._internal.arguments._parse_arguments import parse_dict_to_sysargs, parse_arguments
29
+
17
30
  actions_endpoint = endpoints['actions']
18
31
 
32
+ def is_user_allowed_to_execute(user) -> SuccessTuple:
33
+ if user is None:
34
+ return False, "Could not load user."
35
+
36
+ if user.type == 'admin':
37
+ return True, "Success"
38
+
39
+ allow_non_admin = get_config(
40
+ 'system', 'api', 'permissions', 'actions', 'non_admin', patch=True
41
+ )
42
+ if not allow_non_admin:
43
+ return False, (
44
+ "The administrator for this server has not allowed users to perform actions.\n\n"
45
+ + "Please contact the system administrator, or if you are running this server, "
46
+ + "open the configuration file with `edit config system` "
47
+ + "and search for 'permissions'. "
48
+ + "\nUnder the keys 'api:permissions:actions', "
49
+ + "you can allow non-admin users to perform actions."
50
+ )
51
+
52
+ return True, "Success"
53
+
54
+
19
55
  @app.get(actions_endpoint, tags=['Actions'])
20
56
  def get_actions(
21
- curr_user = (
22
- fastapi.Depends(manager) if private else None
23
- ),
24
- ) -> list:
57
+ curr_user = (
58
+ fastapi.Depends(manager) if private else None
59
+ ),
60
+ ) -> List[str]:
61
+ """
62
+ Return a list of the available actions.
63
+ """
25
64
  return list(actions)
26
65
 
27
- @app.post(actions_endpoint + "/{action}", tags=['Actions'])
28
- def do_action(
29
- action: str,
30
- keywords: dict = fastapi.Body(...),
31
- curr_user = (
32
- fastapi.Depends(manager) if not no_auth else None
33
- ),
34
- ) -> SuccessTuple:
66
+
67
+ async def notify_client(client, content: str):
68
+ """
69
+ Send a line of text to a client.
35
70
  """
36
- Perform a Meerschaum action (if permissions allow it).
71
+ try:
72
+ await client.send_text(content)
73
+ except WebSocketDisconnect:
74
+ pass
37
75
 
38
- Parameters
39
- ----------
40
- action: str :
41
- The action to perform.
42
-
43
- keywords: dict :
44
- The keywords dictionary to pass to the action.
76
+ _temp_jobs = {}
77
+ @app.websocket(actions_endpoint + '/ws')
78
+ async def do_action_websocket(websocket: WebSocket):
79
+ """
80
+ Execute an action and stream the output to the client.
81
+ """
82
+ await websocket.accept()
45
83
 
46
- Returns
47
- -------
48
- A `SuccessTuple` of success, message.
84
+ stop_event = asyncio.Event()
49
85
 
50
- """
51
- if curr_user is not None and curr_user.type != 'admin':
52
- from meerschaum.config import get_config
53
- allow_non_admin = get_config(
54
- 'system', 'api', 'permissions', 'actions', 'non_admin', patch=True
55
- )
56
- if not allow_non_admin:
57
- return False, (
58
- "The administrator for this server has not allowed users to perform actions.\n\n"
59
- + "Please contact the system administrator, or if you are running this server, "
60
- + "open the configuration file with `edit config system` "
61
- + "and search for 'permissions'. "
62
- + "\nUnder the keys 'api:permissions:actions', "
63
- + "you can allow non-admin users to perform actions."
86
+ async def monitor_logs(job):
87
+ success, msg = job.start()
88
+ await job.monitor_logs_async(
89
+ partial(notify_client, websocket),
90
+ stop_event=stop_event,
91
+ stop_on_exit=True,
64
92
  )
65
93
 
66
- if action not in actions:
67
- return False, f"Invalid action '{action}'."
68
- keywords['mrsm_instance'] = keywords.get('mrsm_instance', str(get_api_connector()))
69
- _debug = keywords.get('debug', debug)
70
- keywords.pop('debug', None)
71
- return actions[action](debug=_debug, **keywords)
94
+ job = None
95
+ try:
96
+ token = await websocket.receive_text()
97
+ user = await manager.get_current_user(token) if not no_auth else None
98
+ if user is None and not no_auth:
99
+ raise fastapi.HTTPException(
100
+ status_code=401,
101
+ detail="Invalid credentials.",
102
+ )
103
+
104
+ auth_success, auth_msg = is_user_allowed_to_execute(user)
105
+ auth_payload = {
106
+ 'is_authenticated': auth_success,
107
+ 'timestamp': datetime.now(timezone.utc).isoformat(),
108
+ }
109
+ await websocket.send_json(auth_payload)
110
+ if not auth_success:
111
+ await websocket.close()
112
+
113
+ sysargs = await websocket.receive_json()
114
+ kwargs = parse_arguments(sysargs)
115
+ _ = kwargs.pop('executor_keys', None)
116
+ _ = kwargs.pop('shell', None)
117
+ sysargs = parse_dict_to_sysargs(kwargs)
118
+
119
+ job_name = '.' + generate_password(12)
120
+ job = Job(
121
+ job_name,
122
+ sysargs,
123
+ _properties={
124
+ 'logs': {
125
+ 'write_timestamps': False,
126
+ },
127
+ },
128
+ )
129
+ _temp_jobs[job_name] = job
130
+ monitor_task = asyncio.create_task(monitor_logs(job))
131
+ await monitor_task
132
+ try:
133
+ await websocket.close()
134
+ except RuntimeError:
135
+ pass
136
+ except fastapi.HTTPException:
137
+ await websocket.send_text("Invalid credentials.")
138
+ await websocket.close()
139
+ except WebSocketDisconnect:
140
+ pass
141
+ except asyncio.CancelledError:
142
+ pass
143
+ except Exception:
144
+ warn(f"Error in logs websocket:\n{traceback.format_exc()}")
145
+ finally:
146
+ if job is not None:
147
+ job.delete()
148
+ _ = _temp_jobs.pop(job_name, None)
149
+ stop_event.set()
@@ -0,0 +1,371 @@
1
+ #! /usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # vim:fenc=utf-8
4
+
5
+ """
6
+ Manage jobs via the Meerschaum API.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import os
12
+ import select
13
+ import asyncio
14
+ import traceback
15
+ from datetime import datetime
16
+ from collections import defaultdict
17
+ from functools import partial
18
+
19
+ from fastapi import WebSocket, WebSocketDisconnect
20
+
21
+ from meerschaum.utils.typing import Dict, Any, SuccessTuple, List, Optional, Union
22
+ from meerschaum.utils.jobs import get_jobs as _get_jobs, Job, StopMonitoringLogs
23
+ from meerschaum.utils.warnings import warn
24
+
25
+ from meerschaum.api import (
26
+ fastapi,
27
+ app,
28
+ endpoints,
29
+ manager,
30
+ debug,
31
+ no_auth,
32
+ private,
33
+ )
34
+ from meerschaum.config.static import STATIC_CONFIG
35
+
36
+ JOBS_STDIN_MESSAGE: str = STATIC_CONFIG['api']['jobs']['stdin_message']
37
+ JOBS_STOP_MESSAGE: str = STATIC_CONFIG['api']['jobs']['stop_message']
38
+
39
+
40
+ @app.get(endpoints['jobs'], tags=['Jobs'])
41
+ def get_jobs(
42
+ curr_user=(
43
+ fastapi.Depends(manager) if not no_auth else None
44
+ ),
45
+ ) -> Dict[str, Dict[str, Any]]:
46
+ """
47
+ Return metadata about the current jobs.
48
+ """
49
+ jobs = _get_jobs()
50
+ return {
51
+ name: {
52
+ 'sysargs': job.sysargs,
53
+ 'result': job.result,
54
+ 'daemon': {
55
+ 'status': job.daemon.status,
56
+ 'pid': job.daemon.pid,
57
+ 'properties': job.daemon.properties,
58
+ },
59
+ }
60
+ for name, job in jobs.items()
61
+ }
62
+
63
+
64
+ @app.get(endpoints['jobs'] + '/{name}', tags=['Jobs'])
65
+ def get_job(
66
+ name: str,
67
+ curr_user=(
68
+ fastapi.Depends(manager) if not no_auth else None
69
+ ),
70
+ ) -> Dict[str, Any]:
71
+ """
72
+ Return metadata for a single job.
73
+ """
74
+ job = Job(name)
75
+ if not job.exists():
76
+ raise fastapi.HTTPException(
77
+ status_code=404,
78
+ detail=f"{job} doesn't exist."
79
+ )
80
+
81
+ return {
82
+ 'sysargs': job.sysargs,
83
+ 'result': job.result,
84
+ 'daemon': {
85
+ 'status': job.daemon.status,
86
+ 'pid': job.daemon.pid,
87
+ 'properties': job.daemon.properties,
88
+ },
89
+ }
90
+
91
+
92
+ @app.post(endpoints['jobs'] + '/{name}', tags=['Jobs'])
93
+ def create_job(
94
+ name: str,
95
+ sysargs: List[str],
96
+ curr_user=(
97
+ fastapi.Depends(manager) if not no_auth else None
98
+ ),
99
+ ) -> SuccessTuple:
100
+ """
101
+ Create and start a new job.
102
+ """
103
+ job = Job(name, sysargs)
104
+ if job.exists():
105
+ raise fastapi.HTTPException(
106
+ status_code=409,
107
+ detail=f"{job} already exists."
108
+ )
109
+
110
+ return job.start()
111
+
112
+
113
+ @app.delete(endpoints['jobs'] + '/{name}', tags=['Jobs'])
114
+ def delete_job(
115
+ name: str,
116
+ curr_user=(
117
+ fastapi.Depends(manager) if not no_auth else None
118
+ ),
119
+ ) -> SuccessTuple:
120
+ """
121
+ Delete a job.
122
+ """
123
+ job = Job(name)
124
+ return job.delete()
125
+
126
+
127
+ @app.get(endpoints['jobs'] + '/{name}/exists', tags=['Jobs'])
128
+ def get_job_exists(
129
+ name: str,
130
+ curr_user=(
131
+ fastapi.Depends(manager) if not no_auth else None
132
+ ),
133
+ ) -> bool:
134
+ """
135
+ Return whether a job exists.
136
+ """
137
+ job = Job(name)
138
+ return job.exists()
139
+
140
+
141
+ @app.get(endpoints['logs'] + '/{name}', tags=['Jobs'])
142
+ def get_logs(
143
+ name: str,
144
+ curr_user=(
145
+ fastapi.Depends(manager) if not no_auth else None
146
+ ),
147
+ ) -> Union[str, None]:
148
+ """
149
+ Return a job's log text.
150
+ To stream log text, connect to the WebSocket endpoint `/logs/{name}/ws`.
151
+ """
152
+ job = Job(name)
153
+ if not job.exists():
154
+ raise fastapi.HTTPException(
155
+ status_code=404,
156
+ detail=f"{job} does not exist.",
157
+ )
158
+
159
+ return job.get_logs()
160
+
161
+
162
+ @app.post(endpoints['jobs'] + '/{name}/start', tags=['Jobs'])
163
+ def start_job(
164
+ name: str,
165
+ curr_user=(
166
+ fastapi.Depends(manager) if not no_auth else None
167
+ ),
168
+ ) -> SuccessTuple:
169
+ """
170
+ Start a job if stopped.
171
+ """
172
+ job = Job(name)
173
+ if not job.exists():
174
+ raise fastapi.HTTPException(
175
+ status_code=404,
176
+ detail=f"{job} does not exist."
177
+ )
178
+ return job.start()
179
+
180
+
181
+ @app.post(endpoints['jobs'] + '/{name}/stop', tags=['Jobs'])
182
+ def stop_job(
183
+ name: str,
184
+ curr_user=(
185
+ fastapi.Depends(manager) if not no_auth else None
186
+ ),
187
+ ) -> SuccessTuple:
188
+ """
189
+ Stop a job if running.
190
+ """
191
+ job = Job(name)
192
+ if not job.exists():
193
+ raise fastapi.HTTPException(
194
+ status_code=404,
195
+ detail=f"{job} does not exist."
196
+ )
197
+ return job.stop()
198
+
199
+
200
+ @app.post(endpoints['jobs'] + '/{name}/pause', tags=['Jobs'])
201
+ def pause_job(
202
+ name: str,
203
+ curr_user=(
204
+ fastapi.Depends(manager) if not no_auth else None
205
+ ),
206
+ ) -> SuccessTuple:
207
+ """
208
+ Pause a job if running.
209
+ """
210
+ job = Job(name)
211
+ if not job.exists():
212
+ raise fastapi.HTTPException(
213
+ status_code=404,
214
+ detail=f"{job} does not exist."
215
+ )
216
+ return job.pause()
217
+
218
+
219
+ @app.get(endpoints['jobs'] + '/{name}/stop_time', tags=['Jobs'])
220
+ def get_stop_time(
221
+ name: str,
222
+ curr_user=(
223
+ fastapi.Depends(manager) if not no_auth else None
224
+ ),
225
+ ) -> Union[datetime, None]:
226
+ """
227
+ Get the timestamp when the job was manually stopped.
228
+ """
229
+ job = Job(name)
230
+ return job.stop_time
231
+
232
+
233
+ @app.get(endpoints['jobs'] + '/{name}/is_blocking_on_stdin', tags=['Jobs'])
234
+ def get_is_blocking_on_stdin(
235
+ name: str,
236
+ curr_user=(
237
+ fastapi.Depends(manager) if not no_auth else None
238
+ ),
239
+ ) -> bool:
240
+ """
241
+ Return whether a job is blocking on stdin.
242
+ """
243
+ job = Job(name)
244
+ return job.is_blocking_on_stdin()
245
+
246
+
247
+ _job_clients = defaultdict(lambda: [])
248
+ _job_stop_events = defaultdict(lambda: asyncio.Event())
249
+ async def notify_clients(name: str, websocket: WebSocket, content: str):
250
+ """
251
+ Write the given content to all connected clients.
252
+ """
253
+ async def _notify_client(client):
254
+ try:
255
+ await client.send_text(content)
256
+ except WebSocketDisconnect:
257
+ if client in _job_clients[name]:
258
+ _job_clients[name].remove(client)
259
+ except Exception:
260
+ pass
261
+
262
+ await _notify_client(websocket)
263
+
264
+
265
+ async def get_input_from_clients(name: str, websocket: WebSocket) -> str:
266
+ """
267
+ When a job is blocking on input, return input from the first client which provides it.
268
+ """
269
+ if not _job_clients[name]:
270
+ return ''
271
+
272
+ async def _read_client(client):
273
+ try:
274
+ await client.send_text(JOBS_STDIN_MESSAGE)
275
+ data = await client.receive_text()
276
+ except WebSocketDisconnect:
277
+ if client in _job_clients[name]:
278
+ _job_clients[name].remove(client)
279
+ except Exception:
280
+ pass
281
+ return data
282
+
283
+ read_tasks = [
284
+ asyncio.create_task(_read_client(client))
285
+ for client in _job_clients[name]
286
+ ]
287
+ done, pending = await asyncio.wait(read_tasks, return_when=asyncio.FIRST_COMPLETED)
288
+ for task in pending:
289
+ task.cancel()
290
+ for task in done:
291
+ return task.result()
292
+
293
+
294
+ async def send_stop_message(name: str, client: WebSocket, result: SuccessTuple):
295
+ """
296
+ Send a stop message to clients when the job stops.
297
+ """
298
+ try:
299
+ await client.send_text(JOBS_STOP_MESSAGE)
300
+ await client.send_json(result)
301
+ except WebSocketDisconnect:
302
+ _job_stop_events[name].set()
303
+ if client in _job_clients[name]:
304
+ _job_clients[name].remove(client)
305
+ except RuntimeError:
306
+ pass
307
+ except Exception:
308
+ warn(traceback.format_exc())
309
+
310
+
311
+ @app.websocket(endpoints['logs'] + '/{name}/ws')
312
+ async def logs_websocket(name: str, websocket: WebSocket):
313
+ """
314
+ Stream logs from a job over a websocket.
315
+ """
316
+ await websocket.accept()
317
+ job = Job(name)
318
+ _job_clients[name].append(websocket)
319
+
320
+ async def monitor_logs():
321
+ try:
322
+ callback_function = partial(
323
+ notify_clients,
324
+ name,
325
+ websocket,
326
+ )
327
+ input_callback_function = partial(
328
+ get_input_from_clients,
329
+ name,
330
+ websocket,
331
+ )
332
+ stop_callback_function = partial(
333
+ send_stop_message,
334
+ name,
335
+ websocket,
336
+ )
337
+ await job.monitor_logs_async(
338
+ callback_function=callback_function,
339
+ input_callback_function=input_callback_function,
340
+ stop_callback_function=stop_callback_function,
341
+ stop_event=_job_stop_events[name],
342
+ stop_on_exit=True,
343
+ accept_input=True,
344
+ )
345
+ except Exception:
346
+ warn(traceback.format_exc())
347
+
348
+ try:
349
+ token = await websocket.receive_text()
350
+ user = await manager.get_current_user(token) if not no_auth else None
351
+ if user is None and not no_auth:
352
+ raise fastapi.HTTPException(
353
+ status_code=401,
354
+ detail="Invalid credentials.",
355
+ )
356
+ monitor_task = asyncio.create_task(monitor_logs())
357
+ await monitor_task
358
+ except fastapi.HTTPException:
359
+ await websocket.send_text("Invalid credentials.")
360
+ await websocket.close()
361
+ except WebSocketDisconnect:
362
+ _job_stop_events[name].set()
363
+ monitor_task.cancel()
364
+ except asyncio.CancelledError:
365
+ pass
366
+ except Exception:
367
+ warn(f"Error in logs websocket:\n{traceback.format_exc()}")
368
+ finally:
369
+ if websocket in _job_clients[name]:
370
+ _job_clients[name].remove(websocket)
371
+ _job_stop_events[name].clear()
@@ -201,13 +201,13 @@ async def fetch_pipes_keys(
201
201
 
202
202
  @app.get(pipes_endpoint, tags=['Pipes'])
203
203
  async def get_pipes(
204
- connector_keys : str = "",
205
- metric_keys : str = "",
206
- location_keys : str = "",
207
- curr_user = (
204
+ connector_keys: str = "",
205
+ metric_keys: str = "",
206
+ location_keys: str = "",
207
+ curr_user=(
208
208
  fastapi.Depends(manager) if not no_auth else None
209
209
  ),
210
- debug : bool = False
210
+ debug: bool = False,
211
211
  ) -> Dict[str, Any]:
212
212
  """
213
213
  Get all registered Pipes with metadata, excluding parameters.
@@ -16,6 +16,7 @@ default_meerschaum_config = {
16
16
  'api_instance': 'MRSM{meerschaum:instance}',
17
17
  'web_instance': 'MRSM{meerschaum:instance}',
18
18
  'default_repository': 'api:mrsm',
19
+ 'default_executor': 'local',
19
20
  'connectors': {
20
21
  'sql': {
21
22
  'default': {},
@@ -180,6 +180,7 @@ paths = {
180
180
  'DAEMON_RESOURCES_PATH' : ('{ROOT_DIR_PATH}', 'jobs'),
181
181
  'LOGS_RESOURCES_PATH' : ('{ROOT_DIR_PATH}', 'logs'),
182
182
  'DAEMON_ERROR_LOG_PATH' : ('{ROOT_DIR_PATH}', 'daemon_errors.log'),
183
+ 'CHECK_JOBS_LOCK_PATH' : ('{INTERNAL_RESOURCES_PATH}', 'check-jobs.lock'),
183
184
  }
184
185
 
185
186
  def set_root(root: Union[Path, str]):
@@ -76,6 +76,11 @@ default_shell_config = {
76
76
  'magenta',
77
77
  ],
78
78
  },
79
+ 'executor' : {
80
+ 'rich' : {
81
+ 'style' : 'yellow',
82
+ },
83
+ },
79
84
  'username' : {
80
85
  'rich' : {
81
86
  'style' : 'white',
@@ -112,8 +117,8 @@ default_shell_config = {
112
117
  'ascii' : {
113
118
  'intro' : r""" ___ ___ __ __ __
114
119
  |\/| |__ |__ |__) /__` / ` |__| /\ | | |\/|
115
- | | |___ |___ | \ .__/ \__, | | /~~\ \__/ | |\n""",
116
- 'prompt' : '\n [ {username}@{instance} ] > ',
120
+ | | |___ |___ | \ .__/ \__, | | /~~\ \__/ | |""" + '\n',
121
+ 'prompt' : '\n [ {username}@{instance} | {executor_keys} ] > ',
117
122
  'ruler' : '-',
118
123
  'close_message' : 'Thank you for using Meerschaum!',
119
124
  'doc_header' : 'Meerschaum actions (`help <action>` for usage):',
@@ -124,7 +129,7 @@ default_shell_config = {
124
129
  'intro' : """
125
130
  █▄ ▄█ ██▀ ██▀ █▀▄ ▄▀▀ ▄▀▀ █▄█ ▄▀▄ █ █ █▄ ▄█
126
131
  █ ▀ █ █▄▄ █▄▄ █▀▄ ▄██ ▀▄▄ █ █ █▀█ ▀▄█ █ ▀ █\n""",
127
- 'prompt' : '\n [ {username}@{instance} ] ➤ ',
132
+ 'prompt' : '\n [ {username}@{instance} | {executor_keys} ] ➤ ',
128
133
  'ruler' : '─',
129
134
  'close_message' : ' MRSM{formatting:emoji:hand} Thank you for using Meerschaum! ',
130
135
  'doc_header' : 'Meerschaum actions (`help <action>` for usage):',
@@ -2,4 +2,4 @@
2
2
  Specify the Meerschaum release version.
3
3
  """
4
4
 
5
- __version__ = "2.2.7"
5
+ __version__ = "2.3.0.dev3"
@@ -23,6 +23,8 @@ STATIC_CONFIG: Dict[str, Any] = {
23
23
  'pipes': '/pipes',
24
24
  'metadata': '/metadata',
25
25
  'actions': '/actions',
26
+ 'jobs': '/jobs',
27
+ 'logs': '/logs',
26
28
  'users': '/users',
27
29
  'login': '/login',
28
30
  'connectors': '/connectors',
@@ -40,6 +42,11 @@ STATIC_CONFIG: Dict[str, Any] = {
40
42
  },
41
43
  'webterm_job_name': '_webterm',
42
44
  'default_timeout': 600,
45
+ 'jobs': {
46
+ 'stdin_message': 'MRSM_STDIN',
47
+ 'stop_message': 'MRSM_STOP',
48
+ 'metadata_cache_seconds': 5,
49
+ },
43
50
  },
44
51
  'sql': {
45
52
  'internal_schema': '_mrsm_internal',
@@ -129,6 +136,9 @@ STATIC_CONFIG: Dict[str, Any] = {
129
136
  },
130
137
  'exists_timeout_seconds': 5.0,
131
138
  },
139
+ 'jobs': {
140
+ 'check_restart_seconds': 1.0,
141
+ },
132
142
  'setup': {
133
143
  'name': 'meerschaum',
134
144
  'formal_name': 'Meerschaum',