lumilake-deploy 0.1.0__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.
- lumilake_deploy-0.1.0/LICENSE +201 -0
- lumilake_deploy-0.1.0/PKG-INFO +27 -0
- lumilake_deploy-0.1.0/README.md +4 -0
- lumilake_deploy-0.1.0/pyproject.toml +42 -0
- lumilake_deploy-0.1.0/setup.cfg +4 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/__init__.py +11 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/_demo_data.py +139 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/assets/.env.example +82 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/assets/__init__.py +35 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/assets/compose.yml +40 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/containers.py +48 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/docker_client.py +175 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/doctor.py +237 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/env.py +63 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/errors.py +5 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/flowmesh.py +344 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/setup.py +267 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/shell.py +109 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/stop.py +105 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy/update_flowmesh.py +32 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy.egg-info/PKG-INFO +27 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy.egg-info/SOURCES.txt +23 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy.egg-info/dependency_links.txt +1 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy.egg-info/requires.txt +6 -0
- lumilake_deploy-0.1.0/src/lumilake_deploy.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lumilake-deploy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Lumilake deploy orchestration
|
|
5
|
+
Author: Lumilake contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/mlsys-io/lumilake_OSS
|
|
8
|
+
Project-URL: Repository, https://github.com/mlsys-io/lumilake_OSS
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Requires-Python: <3.13,>=3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: lumilake-sdk==0.1.0
|
|
17
|
+
Requires-Dist: docker>=7.1.0
|
|
18
|
+
Requires-Dist: pyyaml>=6.0
|
|
19
|
+
Requires-Dist: flowmesh-sdk-stack==0.1.1
|
|
20
|
+
Requires-Dist: flowmesh-cli==0.1.1
|
|
21
|
+
Requires-Dist: flowmesh-cli-stack==0.1.1
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# `lumilake-deploy`
|
|
25
|
+
|
|
26
|
+
Deploy orchestration for Lumilake. Install with `pip install lumilake[deploy]`
|
|
27
|
+
or `pip install lumilake-deploy`. See the project README for setup.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "lumilake-deploy"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Lumilake deploy orchestration"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = "<3.13,>=3.12"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "Lumilake contributors"},
|
|
11
|
+
]
|
|
12
|
+
dependencies = [
|
|
13
|
+
"lumilake-sdk==0.1.0",
|
|
14
|
+
"docker>=7.1.0",
|
|
15
|
+
"pyyaml>=6.0",
|
|
16
|
+
"flowmesh-sdk-stack==0.1.1",
|
|
17
|
+
"flowmesh-cli==0.1.1",
|
|
18
|
+
"flowmesh-cli-stack==0.1.1",
|
|
19
|
+
]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 3 - Alpha",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/mlsys-io/lumilake_OSS"
|
|
29
|
+
Repository = "https://github.com/mlsys-io/lumilake_OSS"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["setuptools>=82.0.1", "wheel"]
|
|
33
|
+
build-backend = "setuptools.build_meta"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools]
|
|
36
|
+
package-dir = {"" = "src"}
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.package-data]
|
|
42
|
+
"lumilake_deploy.assets" = ["*", ".env.example"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Lumilake deploy orchestration implementation.
|
|
2
|
+
|
|
3
|
+
Public entry points called from ``cli/commands/deploy.py``:
|
|
4
|
+
|
|
5
|
+
- :func:`setup.run_setup` — stand up the stack from ``.env``.
|
|
6
|
+
- :func:`stop.run_stop` — stop all services (optionally purge volumes).
|
|
7
|
+
- :func:`update_flowmesh.run_update` — re-lock + install latest FlowMesh packages.
|
|
8
|
+
|
|
9
|
+
External binaries (``docker``, ``uv``) are invoked via subprocess; the
|
|
10
|
+
Python layer owns the control flow, parsing, and state.
|
|
11
|
+
"""
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
import sys
|
|
4
|
+
from collections.abc import Iterable
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
from urllib.parse import unquote, urlparse
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True)
|
|
12
|
+
class S3Config:
|
|
13
|
+
endpoint: str
|
|
14
|
+
access_key: str
|
|
15
|
+
secret_key: str
|
|
16
|
+
bucket: str
|
|
17
|
+
secure: bool
|
|
18
|
+
cert_file: str | None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def load_env_file(env_file: Path | None) -> dict[str, str]:
|
|
22
|
+
if env_file is None:
|
|
23
|
+
return {}
|
|
24
|
+
if not env_file.is_file():
|
|
25
|
+
raise FileNotFoundError(f"env file not found: {env_file}")
|
|
26
|
+
pat = re.compile(r"^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*?)\s*$")
|
|
27
|
+
out: dict[str, str] = {}
|
|
28
|
+
for raw in env_file.read_text().splitlines():
|
|
29
|
+
line = raw.split("#", 1)[0].strip()
|
|
30
|
+
if not line:
|
|
31
|
+
continue
|
|
32
|
+
m = pat.match(line)
|
|
33
|
+
if not m:
|
|
34
|
+
continue
|
|
35
|
+
key, value = m.group(1), m.group(2)
|
|
36
|
+
if len(value) >= 2 and value[0] == value[-1] and value[0] in {'"', "'"}:
|
|
37
|
+
value = value[1:-1]
|
|
38
|
+
out[key] = value
|
|
39
|
+
return out
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def resolve_env(
|
|
43
|
+
env_file: Path | None,
|
|
44
|
+
overrides: dict[str, str | None] | None = None,
|
|
45
|
+
) -> dict[str, str]:
|
|
46
|
+
merged: dict[str, str] = {}
|
|
47
|
+
merged.update(load_env_file(env_file))
|
|
48
|
+
for key, value in os.environ.items():
|
|
49
|
+
if value:
|
|
50
|
+
merged[key] = value
|
|
51
|
+
if overrides:
|
|
52
|
+
for key, override in overrides.items():
|
|
53
|
+
if override is not None:
|
|
54
|
+
merged[key] = override
|
|
55
|
+
return merged
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def require_env(env: dict[str, str], keys: Iterable[str]) -> None:
|
|
59
|
+
missing = [k for k in keys if not env.get(k)]
|
|
60
|
+
if missing:
|
|
61
|
+
raise SystemExit(
|
|
62
|
+
f"missing required env variable(s): {', '.join(missing)} "
|
|
63
|
+
"(set in --env-file or process env)"
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def parse_s3_url(raw: str, cert_file: str | None = None) -> S3Config:
|
|
68
|
+
parsed = urlparse(raw)
|
|
69
|
+
if parsed.scheme != "s3":
|
|
70
|
+
raise SystemExit(f"S3_URL must use s3:// scheme: {raw!r}")
|
|
71
|
+
if not parsed.hostname or not parsed.username or not parsed.password:
|
|
72
|
+
raise SystemExit(
|
|
73
|
+
"S3_URL must include credentials and host, e.g. "
|
|
74
|
+
"s3://access:secret@host:port/bucket"
|
|
75
|
+
)
|
|
76
|
+
bucket = parsed.path.lstrip("/").split("/", 1)[0]
|
|
77
|
+
if not bucket:
|
|
78
|
+
raise SystemExit("S3_URL must include a bucket in the path")
|
|
79
|
+
endpoint = parsed.hostname
|
|
80
|
+
if parsed.port:
|
|
81
|
+
endpoint = f"{endpoint}:{parsed.port}"
|
|
82
|
+
return S3Config(
|
|
83
|
+
endpoint=endpoint,
|
|
84
|
+
access_key=unquote(parsed.username),
|
|
85
|
+
secret_key=unquote(parsed.password),
|
|
86
|
+
bucket=bucket,
|
|
87
|
+
secure=bool(cert_file),
|
|
88
|
+
cert_file=cert_file,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def make_minio_client(cfg: S3Config) -> Any:
|
|
93
|
+
try:
|
|
94
|
+
from minio import Minio
|
|
95
|
+
except ImportError as exc:
|
|
96
|
+
raise SystemExit(
|
|
97
|
+
"minio package is required. Install via "
|
|
98
|
+
"`uv sync --all-packages` or `pip install minio`."
|
|
99
|
+
) from exc
|
|
100
|
+
|
|
101
|
+
http_client = None
|
|
102
|
+
if cfg.cert_file:
|
|
103
|
+
import certifi
|
|
104
|
+
import urllib3
|
|
105
|
+
|
|
106
|
+
http_client = urllib3.PoolManager(
|
|
107
|
+
cert_reqs="CERT_REQUIRED",
|
|
108
|
+
ca_certs=cfg.cert_file or certifi.where(),
|
|
109
|
+
)
|
|
110
|
+
return Minio(
|
|
111
|
+
endpoint=cfg.endpoint,
|
|
112
|
+
access_key=cfg.access_key,
|
|
113
|
+
secret_key=cfg.secret_key,
|
|
114
|
+
secure=cfg.secure,
|
|
115
|
+
http_client=http_client,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def find_default_env_file(start: Path | None = None) -> Path | None:
|
|
120
|
+
cur = (start or Path.cwd()).resolve()
|
|
121
|
+
for parent in [cur, *cur.parents]:
|
|
122
|
+
candidate = parent / ".env"
|
|
123
|
+
if candidate.is_file():
|
|
124
|
+
return candidate
|
|
125
|
+
return None
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def info(msg: str) -> None:
|
|
129
|
+
print(msg, file=sys.stderr, flush=True)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def human_bytes(n: int) -> str:
|
|
133
|
+
units = ["B", "KiB", "MiB", "GiB", "TiB"]
|
|
134
|
+
val = float(n)
|
|
135
|
+
for unit in units:
|
|
136
|
+
if val < 1024.0:
|
|
137
|
+
return f"{val:.1f} {unit}"
|
|
138
|
+
val /= 1024.0
|
|
139
|
+
return f"{val:.1f} PiB"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Lumilake server env template.
|
|
2
|
+
#
|
|
3
|
+
# Copy to ``.env`` (run ``lumilake deploy init``) and edit. The packaged
|
|
4
|
+
# compose file consumes this via ``env_file: .env``; local runs load it via
|
|
5
|
+
# ``load_dotenv(".env")``.
|
|
6
|
+
#
|
|
7
|
+
# Run ``lumilake deploy doctor`` after editing to validate.
|
|
8
|
+
|
|
9
|
+
# ── Server ────────────────────────────────────────────────────────────────────
|
|
10
|
+
LUMILAKE_LOG_LEVEL="INFO"
|
|
11
|
+
LUMILAKE_SERVER_HOST="0.0.0.0"
|
|
12
|
+
LUMILAKE_SERVER_PORT="9000"
|
|
13
|
+
|
|
14
|
+
# ── Scheduler ─────────────────────────────────────────────────────────────────
|
|
15
|
+
LUMILAKE_OPTIMIZER_BATCH_SIZE="10"
|
|
16
|
+
LUMILAKE_STARVATION_LIMIT="3"
|
|
17
|
+
LUMILAKE_BATCH_ACCUMULATION_SECONDS="0"
|
|
18
|
+
LUMILAKE_OPTIMIZER_SUBPROCESS_TIMEOUT_SECONDS="60"
|
|
19
|
+
LUMILAKE_CPU_WORKER_GROUP_SIZE="1"
|
|
20
|
+
LUMILAKE_GPU_WORKER_GROUP_SIZE="1"
|
|
21
|
+
# GPU devices Lumilake assigns to FlowMesh workers, one worker per
|
|
22
|
+
# device. Distinct from ``.env.flowmesh``'s ``CUDA_VISIBLE_DEVICES``,
|
|
23
|
+
# which scopes what the FlowMesh server container itself sees. Set to a
|
|
24
|
+
# specific index (e.g. "0") or a comma-separated subset ("0,2") for the
|
|
25
|
+
# free GPUs on your host; "all" expands to every nvidia-smi-detected
|
|
26
|
+
# GPU. Leave blank to skip GPU worker creation.
|
|
27
|
+
LUMILAKE_GPU_DEVICES=""
|
|
28
|
+
|
|
29
|
+
# ── Runtime (FlowMesh) ────────────────────────────────────────────────────────
|
|
30
|
+
# The orchestrator URL the server dispatches workflows to. When using the
|
|
31
|
+
# bundled FlowMesh stack (``lumilake deploy init --flowmesh``), this is
|
|
32
|
+
# the http://127.0.0.1:<flowmesh.server_port> from ``.env.flowmesh``.
|
|
33
|
+
LUMILAKE_RUNTIME_ORCHESTRATOR_URL="http://127.0.0.1:18000"
|
|
34
|
+
LUMILAKE_RUNTIME_TOKEN=""
|
|
35
|
+
|
|
36
|
+
# Worker output delivery: "local" or "http". Both work identically for
|
|
37
|
+
# Lumilake-emitted upstream paths.
|
|
38
|
+
LUMILAKE_FLOWMESH_OUTPUT_DESTINATION="local"
|
|
39
|
+
|
|
40
|
+
# ── Data plane (lumid.data, agent retrievals only) --------------------------
|
|
41
|
+
# Only DataRetrievalOps with ``type: agent`` route through lumid.data;
|
|
42
|
+
# SQL and S3 retrievals always go direct against ``DATABASE_URL`` /
|
|
43
|
+
# ``S3_URL`` below regardless of ``LUMID_DATA_URL``.
|
|
44
|
+
# LUMID_DATA_URL="http://127.0.0.1:9102"
|
|
45
|
+
# LUMID_DATA_TOKEN=""
|
|
46
|
+
# LUMID_DATA_TIMEOUT_SECONDS="30"
|
|
47
|
+
|
|
48
|
+
# ── Compute database -------------------------------------------------------
|
|
49
|
+
# PostgreSQL connection used by every SQL ``DataRetrievalOp``.
|
|
50
|
+
DATABASE_URL="postgresql://lumilake:lumilake_password@127.0.0.1:15432/lumilake"
|
|
51
|
+
|
|
52
|
+
# ── Compute S3 -------------------------------------------------------------
|
|
53
|
+
# S3-compatible connection used by every S3 ``DataRetrievalOp`` and the
|
|
54
|
+
# job-record archive (see ``S3_ARCHIVE_PREFIX``).
|
|
55
|
+
S3_URL="s3://lumilake:lumilake_password@127.0.0.1:19100/lumilake-demo"
|
|
56
|
+
S3_USER_DATA_PREFIX="lumilake-demo"
|
|
57
|
+
# S3_CERT_FILE=""
|
|
58
|
+
|
|
59
|
+
# Archive ``bucket/prefix`` for job records + run artifacts. Shares the
|
|
60
|
+
# ``S3_*`` connection; only the prefix is configurable.
|
|
61
|
+
S3_ARCHIVE_PREFIX="lumilake-archive/artifacts"
|
|
62
|
+
|
|
63
|
+
# ── Tuning (optional) --------------------------------------------------------
|
|
64
|
+
# LUMILAKE_POLL_TIMEOUT_SECONDS=""
|
|
65
|
+
# LUMILAKE_POLL_INTERVAL_SECONDS=""
|
|
66
|
+
# LUMILAKE_HTTP_TIMEOUT_SECONDS="300"
|
|
67
|
+
# LUMILAKE_QUEUE_QUANTUM_MEDIUM=""
|
|
68
|
+
# LUMILAKE_DATA_PROFILE_NUM_TEST_QUERIES="1"
|
|
69
|
+
# LUMILAKE_S3_PROFILE_COST_PER_FILE="0.05"
|
|
70
|
+
# LUMILAKE_S3_PROFILE_COST_PER_MIB="0.01"
|
|
71
|
+
|
|
72
|
+
# ── Hardware Requirements (optional) ─────────────────────────────────────────
|
|
73
|
+
# HARDWARE_CPU_REQUIREMENT="8"
|
|
74
|
+
# HARDWARE_MEMORY_REQUIREMENT="16Gi"
|
|
75
|
+
# HARDWARE_GPU_REQUIREMENT="1"
|
|
76
|
+
# HARDWARE_GPU_MEMORY_REQUIREMENT=""
|
|
77
|
+
|
|
78
|
+
# ── Docker ───────────────────────────────────────────────────────────────────
|
|
79
|
+
# `dev` is the rolling main image. Pin to `vX.Y.Z` for production.
|
|
80
|
+
LUMILAKE_IMAGE_TAG="dev"
|
|
81
|
+
# Trust-bearing override of the server-image registry (see docs/ENV.md).
|
|
82
|
+
# LUMILAKE_REGISTRY="ghcr.io/mlsys-io"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Packaged deploy assets (compose file, env template).
|
|
2
|
+
|
|
3
|
+
Resolved through :mod:`importlib.resources` so the deploy CLI works the
|
|
4
|
+
same from a workspace checkout or a PyPI install — operators don't have
|
|
5
|
+
to be in (or even have) a Lumilake source tree.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from importlib import resources
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AssetNotFoundError(FileNotFoundError):
|
|
13
|
+
"""Raised when a packaged asset cannot be resolved."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def asset_path(*parts: str) -> Path:
|
|
17
|
+
"""Return a usable filesystem path for an asset inside this package."""
|
|
18
|
+
resource = resources.files(__name__)
|
|
19
|
+
for part in parts:
|
|
20
|
+
resource /= part
|
|
21
|
+
try:
|
|
22
|
+
with resources.as_file(resource) as path:
|
|
23
|
+
return Path(path)
|
|
24
|
+
except FileNotFoundError as exc:
|
|
25
|
+
raise AssetNotFoundError(str(resource)) from exc
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def env_example_path() -> Path:
|
|
29
|
+
"""Path to the bundled ``.env.example`` template."""
|
|
30
|
+
return asset_path(".env.example")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def compose_path() -> Path:
|
|
34
|
+
"""Path to the bundled ``compose.yml`` (docker-compose) file."""
|
|
35
|
+
return asset_path("compose.yml")
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
x-logging: &default-logging
|
|
2
|
+
driver: json-file
|
|
3
|
+
options:
|
|
4
|
+
max-size: "10m"
|
|
5
|
+
max-file: "3"
|
|
6
|
+
|
|
7
|
+
x-logging-verbose: &verbose-logging
|
|
8
|
+
driver: json-file
|
|
9
|
+
options:
|
|
10
|
+
max-size: "50m"
|
|
11
|
+
max-file: "3"
|
|
12
|
+
|
|
13
|
+
services:
|
|
14
|
+
server:
|
|
15
|
+
image: ${LUMILAKE_REGISTRY:-ghcr.io/mlsys-io}/lumilake_server:${LUMILAKE_IMAGE_TAG:-dev}
|
|
16
|
+
# Use the locally-tagged image when present (so ``lumilake deploy
|
|
17
|
+
# build`` outputs are honored); ``lumilake deploy pull`` resolves
|
|
18
|
+
# rolling :dev/:latest tags explicitly when an update is wanted.
|
|
19
|
+
pull_policy: missing
|
|
20
|
+
container_name: lumilake-server
|
|
21
|
+
profiles: ["server"]
|
|
22
|
+
network_mode: host
|
|
23
|
+
env_file: .env
|
|
24
|
+
environment:
|
|
25
|
+
# Env vars are injected via env_file; no .env inside the container.
|
|
26
|
+
LUMILAKE_SKIP_DOTENV_CHECK: "1"
|
|
27
|
+
volumes:
|
|
28
|
+
# Surface the host's S3 cert at the same path inside the container
|
|
29
|
+
# so ``S3_CERT_FILE`` resolves. Mounting ``/dev/null`` is a no-op
|
|
30
|
+
# when the variable is unset (direct-mode without TLS verification).
|
|
31
|
+
- ${S3_CERT_FILE:-/dev/null}:${S3_CERT_FILE:-/dev/null}:ro
|
|
32
|
+
healthcheck:
|
|
33
|
+
test: ["CMD", "python", "-c", "import os, urllib.request; urllib.request.urlopen(f'http://localhost:{os.environ.get(\"LUMILAKE_SERVER_PORT\", \"9000\")}/healthz')"]
|
|
34
|
+
interval: 10s
|
|
35
|
+
timeout: 5s
|
|
36
|
+
retries: 12
|
|
37
|
+
# Cover envs.validate() + DB pool init before unhealthy.
|
|
38
|
+
start_period: 40s
|
|
39
|
+
restart: unless-stopped
|
|
40
|
+
logging: *verbose-logging
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Service-to-container mapping for the Lumilake stack.
|
|
2
|
+
|
|
3
|
+
FlowMesh names containers and volumes from ``FLOWMESH_STACK_SLUG`` (the
|
|
4
|
+
slugged form of ``FLOWMESH_STACK_SUFFIX``). ``lumilake deploy init
|
|
5
|
+
--flowmesh`` sets the suffix to ``lumilake``, so the SDK can't hardcode
|
|
6
|
+
``flowmesh_node_*`` — it has to look the slug up from ``.env.flowmesh``
|
|
7
|
+
in the operator's deployment directory.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
from . import flowmesh as fm_mod
|
|
13
|
+
from .env import FLOWMESH_ENV_FILE_NAME
|
|
14
|
+
|
|
15
|
+
SERVICE_NAMES: tuple[str, ...] = (
|
|
16
|
+
"server",
|
|
17
|
+
"flowmesh",
|
|
18
|
+
"flowmesh-redis",
|
|
19
|
+
"flowmesh-redis-telemetry",
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def container_names(deploy_dir: Path) -> dict[str, str]:
|
|
24
|
+
"""Map each service name to the docker container name.
|
|
25
|
+
|
|
26
|
+
Looks up ``FLOWMESH_STACK_SLUG`` from ``deploy_dir/.env.flowmesh``
|
|
27
|
+
when present; falls back to ``flowmesh_node`` so the SDK keeps
|
|
28
|
+
pre-init behavior intact.
|
|
29
|
+
"""
|
|
30
|
+
env_fm = deploy_dir / FLOWMESH_ENV_FILE_NAME
|
|
31
|
+
slug = fm_mod.stack_slug(env_fm) if env_fm.is_file() else "flowmesh_node"
|
|
32
|
+
return {
|
|
33
|
+
"server": "lumilake-server",
|
|
34
|
+
"flowmesh": f"{slug}_server",
|
|
35
|
+
"flowmesh-redis": f"{slug}_redis_control",
|
|
36
|
+
"flowmesh-redis-telemetry": f"{slug}_redis_telemetry",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def flowmesh_state_volumes(deploy_dir: Path) -> tuple[str, ...]:
|
|
41
|
+
"""Volume names FlowMesh creates for its postgres + redis state."""
|
|
42
|
+
env_fm = deploy_dir / FLOWMESH_ENV_FILE_NAME
|
|
43
|
+
slug = fm_mod.stack_slug(env_fm) if env_fm.is_file() else "flowmesh_node"
|
|
44
|
+
return (
|
|
45
|
+
f"{slug}_postgres_data",
|
|
46
|
+
f"{slug}_redis_control_data",
|
|
47
|
+
f"{slug}_redis_telemetry_data",
|
|
48
|
+
)
|