datatailr 0.1.25__tar.gz → 0.1.27__tar.gz
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.
Potentially problematic release.
This version of datatailr might be problematic. Click here for more details.
- {datatailr-0.1.25/src/datatailr.egg-info → datatailr-0.1.27}/PKG-INFO +1 -1
- {datatailr-0.1.25 → datatailr-0.1.27}/pyproject.toml +1 -1
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/group.py +2 -2
- {datatailr-0.1.25 → datatailr-0.1.27/src/datatailr.egg-info}/PKG-INFO +1 -1
- {datatailr-0.1.25 → datatailr-0.1.27}/src/sbin/datatailr_run.py +22 -8
- {datatailr-0.1.25 → datatailr-0.1.27}/LICENSE +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/README.md +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/setup.cfg +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/setup.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/__init__.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/acl.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/blob.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/build/__init__.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/build/image.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/dt_json.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/errors.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/excel.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/logging.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/scheduler/__init__.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/scheduler/arguments_cache.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/scheduler/base.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/scheduler/batch.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/scheduler/batch_decorator.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/scheduler/constants.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/scheduler/schedule.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/scheduler/utils.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/user.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/utils.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/version.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr/wrapper.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr.egg-info/SOURCES.txt +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr.egg-info/dependency_links.txt +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr.egg-info/entry_points.txt +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr.egg-info/requires.txt +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/datatailr.egg-info/top_level.txt +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/sbin/datatailr_run_app.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/sbin/datatailr_run_batch.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/sbin/datatailr_run_excel.py +0 -0
- {datatailr-0.1.25 → datatailr-0.1.27}/src/sbin/datatailr_run_service.py +0 -0
|
@@ -103,8 +103,8 @@ class Group:
|
|
|
103
103
|
|
|
104
104
|
@staticmethod
|
|
105
105
|
def add(name: str) -> Optional["Group"]:
|
|
106
|
-
__client__.add(name)
|
|
107
|
-
return Group
|
|
106
|
+
new_group = __client__.add(name, json_enrichened=True)
|
|
107
|
+
return Group(new_group["name"]) if new_group else None
|
|
108
108
|
|
|
109
109
|
@staticmethod
|
|
110
110
|
def ls() -> list:
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
# DATATAILR_JOB_ID - the unique identifier for the job.
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
import subprocess
|
|
35
36
|
import os
|
|
36
37
|
import sys
|
|
37
38
|
from typing import Tuple
|
|
@@ -80,18 +81,29 @@ def create_user_and_group() -> Tuple[str, str]:
|
|
|
80
81
|
return user, group
|
|
81
82
|
|
|
82
83
|
|
|
83
|
-
def run_command_as_user(command: str, user: str, env_vars: dict):
|
|
84
|
+
def run_command_as_user(command: str | list, user: str, env_vars: dict):
|
|
84
85
|
"""
|
|
85
86
|
Run a command as a specific user with the given environment variables.
|
|
86
87
|
"""
|
|
88
|
+
if isinstance(command, str):
|
|
89
|
+
command = command.split(" ")
|
|
87
90
|
env_vars.update({"PATH": get_env_var("PATH")})
|
|
88
91
|
env_vars.update({"PYTHONPATH": get_env_var("PYTHONPATH", "")})
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
full_command = ["sudo", "-u", user, "bash", "-c", *command]
|
|
93
|
+
|
|
94
|
+
try:
|
|
95
|
+
result = subprocess.run(
|
|
96
|
+
full_command,
|
|
97
|
+
env=env_vars,
|
|
98
|
+
check=True, # raises if returncode != 0
|
|
99
|
+
capture_output=True,
|
|
100
|
+
text=True,
|
|
101
|
+
)
|
|
102
|
+
logger.info(f"stdout: {result.stdout}")
|
|
103
|
+
logger.debug(f"stderr: {result.stderr}")
|
|
104
|
+
except subprocess.CalledProcessError as e:
|
|
105
|
+
logger.error(f"Command failed with exit code {e.returncode}")
|
|
106
|
+
logger.error(f"stderr: {e.stderr}")
|
|
95
107
|
sys.exit(1)
|
|
96
108
|
|
|
97
109
|
|
|
@@ -138,7 +150,9 @@ def main():
|
|
|
138
150
|
} | env
|
|
139
151
|
run_command_as_user("datatailr_run_excel", user, env)
|
|
140
152
|
elif job_type == "IDE":
|
|
141
|
-
|
|
153
|
+
run_command_as_user("code server", user, env)
|
|
154
|
+
elif job_type == "jupyter":
|
|
155
|
+
run_command_as_user("jupyter lab", user, env)
|
|
142
156
|
else:
|
|
143
157
|
raise ValueError(f"Unknown job type: {job_type}")
|
|
144
158
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|