dataflow-core 2.0.5__tar.gz → 2.0.6__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 dataflow-core might be problematic. Click here for more details.
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/PKG-INFO +1 -1
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/dataflow.py +43 -4
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/PKG-INFO +1 -1
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/setup.py +5 -3
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/README.md +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/__init__.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/dataflowairflowauthenticator.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/dataflowhubauthenticator.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/dataflowsupersetauthenticator.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/__init__.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/configuration.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/models/__init__.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/models/database.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/models/session.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/models/user.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/__init__.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/configuration.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/models/__init__.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/models/database.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/models/session.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/models/user.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/utils/__init__.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/utils/aws_secrets_manager.py +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/SOURCES.txt +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/dependency_links.txt +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/entry_points.txt +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/requires.txt +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/top_level.txt +0 -0
- {dataflow-core-2.0.5 → dataflow-core-2.0.6}/setup.cfg +0 -0
|
@@ -2,21 +2,21 @@ import os, requests
|
|
|
2
2
|
from .models.database import DatabaseManager
|
|
3
3
|
from sqlalchemy.inspection import inspect
|
|
4
4
|
from .utils.aws_secrets_manager import SecretsManagerClient
|
|
5
|
-
import json
|
|
5
|
+
import json, asyncio, pkg_resources
|
|
6
6
|
from authenticator.package.configuration import ConfigurationManager
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Dataflow:
|
|
10
10
|
def __init__(self):
|
|
11
|
-
self.dataflow_config = ConfigurationManager('/dataflow/app/auth_config/dataflow_auth.cfg')
|
|
12
|
-
self.auth_api = self.dataflow_config.get_config_value('auth', 'ui_auth_api')
|
|
13
11
|
self.secrets_manager = SecretsManagerClient('us-east-1')
|
|
14
12
|
|
|
15
13
|
def auth(self, session_id: str):
|
|
16
14
|
"""Retrieve user information from the auth API."""
|
|
17
15
|
try:
|
|
16
|
+
dataflow_config = ConfigurationManager('/dataflow/app/auth_config/dataflow_auth.cfg')
|
|
17
|
+
auth_api = dataflow_config.get_config_value('auth', 'ui_auth_api')
|
|
18
18
|
response = requests.get(
|
|
19
|
-
|
|
19
|
+
auth_api,
|
|
20
20
|
cookies={"dataflow_session": session_id, "jupyterhub-hub-login": ""}
|
|
21
21
|
)
|
|
22
22
|
|
|
@@ -86,3 +86,42 @@ class Dataflow:
|
|
|
86
86
|
|
|
87
87
|
except Exception as e:
|
|
88
88
|
return None
|
|
89
|
+
|
|
90
|
+
async def create_env(self, env_name, py_version, py_requirements, status, env_version=None):
|
|
91
|
+
"""
|
|
92
|
+
Creates a conda environment at the specified path and installs libraries in one command.
|
|
93
|
+
"""
|
|
94
|
+
config = ConfigurationManager('/dataflow/app/config/dataflow.cfg')
|
|
95
|
+
status = status.lower()
|
|
96
|
+
if status == "published":
|
|
97
|
+
env_base_path = config.get_config_value('paths', 'published_env_path')
|
|
98
|
+
conda_env_path = os.path.join(env_base_path, env_name)
|
|
99
|
+
else:
|
|
100
|
+
env_base_path = config.get_config_value('paths', 'drafts_env_path')
|
|
101
|
+
conda_env_path = os.path.join(env_base_path, env_name, f"{env_name}_v{env_version}")
|
|
102
|
+
try:
|
|
103
|
+
if not os.path.exists(conda_env_path):
|
|
104
|
+
os.makedirs(conda_env_path, exist_ok=True)
|
|
105
|
+
|
|
106
|
+
py_requirements = ",".join(py_requirements)
|
|
107
|
+
|
|
108
|
+
script_path = pkg_resources.resource_filename('dataflow', 'scripts/create_environment.sh')
|
|
109
|
+
|
|
110
|
+
# Make the script executable
|
|
111
|
+
os.chmod(script_path, 0o755)
|
|
112
|
+
|
|
113
|
+
# Prepare command with arguments
|
|
114
|
+
command = ["bash", script_path, py_requirements, conda_env_path, py_version]
|
|
115
|
+
|
|
116
|
+
process = await asyncio.create_subprocess_exec(
|
|
117
|
+
*command,
|
|
118
|
+
stdout=asyncio.subprocess.PIPE,
|
|
119
|
+
stderr=asyncio.subprocess.PIPE
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
return process
|
|
123
|
+
except OSError as e:
|
|
124
|
+
print(f"OS error while creating {conda_env_path}: {e}")
|
|
125
|
+
except Exception as e:
|
|
126
|
+
print(f"Unexpected error while creating {conda_env_path}: {e}")
|
|
127
|
+
return {"error": str(e)}
|
|
@@ -2,10 +2,12 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="dataflow-core",
|
|
5
|
-
version="2.0.
|
|
6
|
-
packages=find_packages(
|
|
5
|
+
version="2.0.6",
|
|
6
|
+
packages=find_packages(include=["dataflow", "dataflow.*", "authenticator", "authenticator.*"]),
|
|
7
7
|
include_package_data=True,
|
|
8
|
-
package_data={
|
|
8
|
+
package_data={
|
|
9
|
+
"dataflow": ["scripts/*.sh"],
|
|
10
|
+
},
|
|
9
11
|
install_requires=[
|
|
10
12
|
'sqlalchemy',
|
|
11
13
|
'boto3',
|
|
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
|