datatailr 0.1.47__py3-none-any.whl → 0.1.49__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.
Potentially problematic release.
This version of datatailr might be problematic. Click here for more details.
- datatailr/sbin/datatailr_run.py +15 -9
- datatailr/sbin/datatailr_run_app.py +7 -3
- {datatailr-0.1.47.dist-info → datatailr-0.1.49.dist-info}/METADATA +1 -1
- {datatailr-0.1.47.dist-info → datatailr-0.1.49.dist-info}/RECORD +8 -8
- {datatailr-0.1.47.dist-info → datatailr-0.1.49.dist-info}/WHEEL +0 -0
- {datatailr-0.1.47.dist-info → datatailr-0.1.49.dist-info}/entry_points.txt +0 -0
- {datatailr-0.1.47.dist-info → datatailr-0.1.49.dist-info}/licenses/LICENSE +0 -0
- {datatailr-0.1.47.dist-info → datatailr-0.1.49.dist-info}/top_level.txt +0 -0
datatailr/sbin/datatailr_run.py
CHANGED
|
@@ -85,25 +85,31 @@ def run_command_as_user(command: str | list, user: str, env_vars: dict):
|
|
|
85
85
|
"""
|
|
86
86
|
Run a command as a specific user with the given environment variables.
|
|
87
87
|
"""
|
|
88
|
+
if os.path.isfile("/etc/python-site-location"):
|
|
89
|
+
with open("/etc/python-site-location") as f:
|
|
90
|
+
python_site = f.read().rstrip()
|
|
91
|
+
else:
|
|
92
|
+
# make this empty string once file creation is merged into build/Dockerfile
|
|
93
|
+
python_site = (
|
|
94
|
+
"/opt/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/site-packages"
|
|
95
|
+
)
|
|
96
|
+
|
|
88
97
|
if isinstance(command, list):
|
|
89
98
|
command = " ".join(command)
|
|
90
99
|
env_vars = {
|
|
91
100
|
"PATH": get_env_var("PATH", ""),
|
|
92
|
-
"PYTHONPATH": get_env_var("PYTHONPATH", ""),
|
|
101
|
+
"PYTHONPATH": get_env_var("PYTHONPATH", "") + ":" + python_site,
|
|
93
102
|
} | env_vars
|
|
94
103
|
|
|
95
104
|
env_kv = [f"{k}={v}" for k, v in env_vars.items()]
|
|
96
105
|
argv = ["sudo", "-u", user, "env", *env_kv, "bash", "-lc", command]
|
|
97
106
|
|
|
98
107
|
try:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)
|
|
105
|
-
logger.info(f"stdout: {result.stdout}")
|
|
106
|
-
logger.debug(f"stderr: {result.stderr}")
|
|
108
|
+
proc = subprocess.Popen(argv)
|
|
109
|
+
returncode = proc.wait()
|
|
110
|
+
if returncode != 0:
|
|
111
|
+
logger.error(f"Command failed with exit code {returncode}")
|
|
112
|
+
sys.exit(returncode)
|
|
107
113
|
except subprocess.CalledProcessError as e:
|
|
108
114
|
logger.error(f"Command failed with exit code {e.returncode}")
|
|
109
115
|
logger.error(f"stderr: {e.stderr}")
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
import os
|
|
14
14
|
import sys
|
|
15
15
|
import runpy
|
|
16
|
-
|
|
16
|
+
import inspect
|
|
17
|
+
import importlib
|
|
17
18
|
|
|
18
19
|
from datatailr.logging import DatatailrLogger
|
|
19
20
|
|
|
@@ -29,9 +30,12 @@ def run():
|
|
|
29
30
|
"Environment variable 'DATATAILR_ENTRYPOINT' is not in the format 'module_name:file_name'."
|
|
30
31
|
)
|
|
31
32
|
|
|
32
|
-
module_name,
|
|
33
|
+
module_name, func_name = entrypoint.split(":")
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
# consider using ast
|
|
36
|
+
module = importlib.import_module(module_name)
|
|
37
|
+
function = getattr(module, func_name)
|
|
38
|
+
script = inspect.getfile(function)
|
|
35
39
|
sys.argv = ["streamlit", "run", str(script), *sys.argv[1:]]
|
|
36
40
|
logger.info(f"Running entrypoint: {entrypoint}")
|
|
37
41
|
runpy.run_module("streamlit", run_name="__main__")
|
|
@@ -12,8 +12,8 @@ datatailr/version.py,sha256=N9K8ZxlwFFSz8XSgbgaTWZY4k2J0JKfj698nZ_O2pIU,536
|
|
|
12
12
|
datatailr/wrapper.py,sha256=K9ZD76cWey_ikA6C5sKejwRaYBDln4QMg-RcoRGiuFc,7991
|
|
13
13
|
datatailr/build/__init__.py,sha256=_dA7b4L6wsaAFaSxUoYSJ1oaRqDHDMR20kqoCocSOss,487
|
|
14
14
|
datatailr/build/image.py,sha256=YC8ML-l-sj6TcIBY-DCx_vaeI_7SmL9fPFhHnuxzRh0,5509
|
|
15
|
-
datatailr/sbin/datatailr_run.py,sha256=
|
|
16
|
-
datatailr/sbin/datatailr_run_app.py,sha256=
|
|
15
|
+
datatailr/sbin/datatailr_run.py,sha256=jgMBIRLYTcCdvSIe77wrdf8XIbadn0hE0REs8sMc6dY,7274
|
|
16
|
+
datatailr/sbin/datatailr_run_app.py,sha256=pYiofYG13R6YIiN81n7MNn5_mLdZM9vuFJH-RjdvtRM,1329
|
|
17
17
|
datatailr/sbin/datatailr_run_batch.py,sha256=UWnp96j_G66R_Cape7Bb-rbK6UBLF7Y5_mTlWyGJAVQ,1818
|
|
18
18
|
datatailr/sbin/datatailr_run_excel.py,sha256=MY2XH-T5bWABR23C_15eLhjaxggGRgjRhA-ByS6CtMc,1422
|
|
19
19
|
datatailr/sbin/datatailr_run_service.py,sha256=R8eNLN2SGnMtyfLy3vq9isUHr3dRzeBqESTquNK9Iho,1156
|
|
@@ -25,9 +25,9 @@ datatailr/scheduler/batch_decorator.py,sha256=LqL1bsupWLn-YEQUvFJYae7R3ogrL5-Vod
|
|
|
25
25
|
datatailr/scheduler/constants.py,sha256=5WWTsfwZ_BA8gVDOTa2AQX9DJ0NzfaWgtY3vrODS2-8,606
|
|
26
26
|
datatailr/scheduler/schedule.py,sha256=0XJJen2nL1xplRs0Xbjwgq3T-0bFCOrJzkSALdio998,3741
|
|
27
27
|
datatailr/scheduler/utils.py,sha256=up6oR2iwe6G52LkvgfO394xchXgCYNjOMGRQW3e8PQk,1082
|
|
28
|
-
datatailr-0.1.
|
|
29
|
-
datatailr-0.1.
|
|
30
|
-
datatailr-0.1.
|
|
31
|
-
datatailr-0.1.
|
|
32
|
-
datatailr-0.1.
|
|
33
|
-
datatailr-0.1.
|
|
28
|
+
datatailr-0.1.49.dist-info/licenses/LICENSE,sha256=ikKP4_O-UD_b8FuNdKmbzTb6odd0JX085ZW_FAPN3VI,1066
|
|
29
|
+
datatailr-0.1.49.dist-info/METADATA,sha256=BcUo34as2Gig3d9sFeqCEZwXSJ7tH5E8KxaNytJfqQI,5146
|
|
30
|
+
datatailr-0.1.49.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
31
|
+
datatailr-0.1.49.dist-info/entry_points.txt,sha256=YqXfk2At-olW4PUSRkqvy_O3Mbv7uTKCCPuAAiz3Qbg,312
|
|
32
|
+
datatailr-0.1.49.dist-info/top_level.txt,sha256=75gntW0X_SKpqxLL6hAPipvpk28GAhJBvoyqN_HohWU,10
|
|
33
|
+
datatailr-0.1.49.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|