cycls 0.0.2.35__tar.gz → 0.0.2.36__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.
- {cycls-0.0.2.35 → cycls-0.0.2.36}/PKG-INFO +1 -1
- {cycls-0.0.2.35 → cycls-0.0.2.36}/cycls/runtime.py +16 -18
- {cycls-0.0.2.35 → cycls-0.0.2.36}/cycls/sdk.py +2 -1
- {cycls-0.0.2.35 → cycls-0.0.2.36}/pyproject.toml +1 -1
- {cycls-0.0.2.35 → cycls-0.0.2.36}/README.md +0 -0
- {cycls-0.0.2.35 → cycls-0.0.2.36}/cycls/__init__.py +0 -0
- {cycls-0.0.2.35 → cycls-0.0.2.36}/cycls/theme/assets/index-D0-uI8sw.js +0 -0
- {cycls-0.0.2.35 → cycls-0.0.2.36}/cycls/theme/index.html +0 -0
- {cycls-0.0.2.35 → cycls-0.0.2.36}/cycls/web.py +0 -0
|
@@ -118,6 +118,7 @@ class Runtime:
|
|
|
118
118
|
sys.exit(1)
|
|
119
119
|
return self._docker_client
|
|
120
120
|
|
|
121
|
+
# docker system prune -af
|
|
121
122
|
def _perform_auto_cleanup(self):
|
|
122
123
|
"""Performs a simple, automatic cleanup of old Docker resources."""
|
|
123
124
|
try:
|
|
@@ -125,7 +126,7 @@ class Runtime:
|
|
|
125
126
|
container.remove(force=True)
|
|
126
127
|
|
|
127
128
|
cleaned_images = 0
|
|
128
|
-
for image in self.docker_client.images.list(
|
|
129
|
+
for image in self.docker_client.images.list(all=True, filters={"label": self.managed_label}):
|
|
129
130
|
is_current = self.tag in image.tags
|
|
130
131
|
is_deployable = any(t.startswith(f"{self.image_prefix}:deploy-") for t in image.tags)
|
|
131
132
|
|
|
@@ -168,11 +169,7 @@ class Runtime:
|
|
|
168
169
|
if self.apt_packages else ""
|
|
169
170
|
)
|
|
170
171
|
run_shell_commands = "\n".join([f"RUN {cmd}" for cmd in self.run_commands]) if self.run_commands else ""
|
|
171
|
-
|
|
172
|
-
# fixes absolute path copy, but causes collision
|
|
173
|
-
copy_lines = "\n".join([f"COPY {Path(src).name} {dst}" for src, dst in self.copy.items()])
|
|
174
|
-
# copy_lines = "\n".join([f"COPY {src} {dst}" for src, dst in self.copy.items()])
|
|
175
|
-
|
|
172
|
+
copy_lines = "\n".join([f"COPY context_files/{dst} {dst}" for dst in self.copy.values()])
|
|
176
173
|
expose_line = f"EXPOSE {port}" if port else ""
|
|
177
174
|
|
|
178
175
|
return f"""
|
|
@@ -198,6 +195,16 @@ COPY {self.payload_file} {self.io_dir}/
|
|
|
198
195
|
"""Prepares a complete build context in the given directory."""
|
|
199
196
|
port = kwargs.get('port') if kwargs else None
|
|
200
197
|
|
|
198
|
+
# Create a dedicated subdirectory for all user-copied files
|
|
199
|
+
context_files_dir = workdir / "context_files"
|
|
200
|
+
context_files_dir.mkdir()
|
|
201
|
+
|
|
202
|
+
if self.copy:
|
|
203
|
+
for src, dst in self.copy.items():
|
|
204
|
+
src_path = Path(src).resolve() # Resolve to an absolute path
|
|
205
|
+
dest_in_context = context_files_dir / dst
|
|
206
|
+
_copy_path(src_path, dest_in_context)
|
|
207
|
+
|
|
201
208
|
(workdir / "Dockerfile").write_text(self._generate_dockerfile(port=port))
|
|
202
209
|
(workdir / self.runner_filename).write_text(self.runner_script)
|
|
203
210
|
|
|
@@ -205,16 +212,6 @@ COPY {self.payload_file} {self.io_dir}/
|
|
|
205
212
|
payload_bytes = cloudpickle.dumps((self.func, args or [], kwargs or {}))
|
|
206
213
|
(workdir / self.payload_file).write_bytes(payload_bytes)
|
|
207
214
|
|
|
208
|
-
if self.copy:
|
|
209
|
-
# for src in self.copy.keys():
|
|
210
|
-
# _copy_path(Path(src), workdir / src)
|
|
211
|
-
|
|
212
|
-
# fixes absolute path copy
|
|
213
|
-
for src in self.copy.keys():
|
|
214
|
-
src_path = Path(src)
|
|
215
|
-
dest_path = workdir / src_path.name if src_path.is_absolute() else workdir / src
|
|
216
|
-
_copy_path(src_path, dest_path)
|
|
217
|
-
|
|
218
215
|
def _build_image_if_needed(self):
|
|
219
216
|
"""Checks if the base Docker image exists locally and builds it if not."""
|
|
220
217
|
try:
|
|
@@ -235,7 +232,8 @@ COPY {self.payload_file} {self.io_dir}/
|
|
|
235
232
|
tag=self.tag,
|
|
236
233
|
forcerm=True,
|
|
237
234
|
decode=True,
|
|
238
|
-
target='base' # Only build the 'base' stage
|
|
235
|
+
target='base', # Only build the 'base' stage
|
|
236
|
+
labels={self.managed_label: "true"}, # image label
|
|
239
237
|
)
|
|
240
238
|
try:
|
|
241
239
|
for chunk in response_generator:
|
|
@@ -269,7 +267,7 @@ COPY {self.payload_file} {self.io_dir}/
|
|
|
269
267
|
image=self.tag,
|
|
270
268
|
volumes={str(tmpdir): {'bind': self.io_dir, 'mode': 'rw'}},
|
|
271
269
|
ports=ports_mapping,
|
|
272
|
-
labels={self.managed_label: "true"}
|
|
270
|
+
labels={self.managed_label: "true"} # container label
|
|
273
271
|
)
|
|
274
272
|
container.start()
|
|
275
273
|
yield container, result_path
|
|
@@ -102,6 +102,7 @@ class Agent:
|
|
|
102
102
|
with modal.enable_output(), run_app(app=self.app, client=self.client):
|
|
103
103
|
while True: time.sleep(10)
|
|
104
104
|
|
|
105
|
+
# docker system prune -af
|
|
105
106
|
# poetry config pypi-token.pypi <your-token>
|
|
106
|
-
# poetry run python agent.py
|
|
107
|
+
# poetry run python agent-cycls.py
|
|
107
108
|
# poetry publish --build
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|