Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Permissions on artifacts #2669

Open
fnikolai opened this issue Dec 4, 2024 · 0 comments
Open

[BUG] Permissions on artifacts #2669

fnikolai opened this issue Dec 4, 2024 · 0 comments
Labels
🐛 bug Something isn't working mission critical

Comments

@fnikolai
Copy link
Collaborator

fnikolai commented Dec 4, 2024

When we start the rest server on snowflake it returns the following error.

| ERROR:    Traceback (most recent call last):                                                                                                                                                                                               |
|   File "/home/superduper/.local/lib/python3.10/site-packages/starlette/routing.py", line 693, in lifespan                                                                                                                                  |
|     async with self.lifespan_context(app) as maybe_state:                                                                                                                                                                                  |
|   File "/usr/lib/python3.10/contextlib.py", line 199, in __aenter__                                                                                                                                                                        |
|     return await anext(self.gen)                                                                                                                                                                                                           |
|   File "/home/superduper/.local/lib/python3.10/site-packages/fastapi/routing.py", line 133, in merged_lifespan                                                                                                                             |
|     async with original_context(app) as maybe_original_state:                                                                                                                                                                              |
|   File "/home/superduper/.local/lib/python3.10/site-packages/starlette/routing.py", line 569, in __aenter__                                                                                                                                |
|     await self._router.startup()                                                                                                                                                                                                           |
|   File "/home/superduper/.local/lib/python3.10/site-packages/starlette/routing.py", line 670, in startup                                                                                                                                   |
|     await handler()                                                                                                                                                                                                                        |
|   File "/home/superduper/superduper_services/superduper_services/server/app.py", line 221, in startup_event                                                                                                                                |
|     self._startup(function=function, cfg=cfg)                                                                                                                                                                                              |
|   File "/home/superduper/superduper_services/superduper_services/server/app.py", line 183, in _startup                                                                                                                                     |
|     self._add_templates(temp_db)                                                                                                                                                                                                           |
|   File "/home/superduper/.local/lib/python3.10/site-packages/superduper/rest/base.py", line 206, in _add_templates                                                                                                                         |
|     db.apply(t, force=True)                                                                                                                                                                                                                |
|   File "/home/superduper/.local/lib/python3.10/site-packages/superduper/base/datalayer.py", line 456, in apply                                                                                                                             |
|     return apply.apply(                                                                                                                                                                                                                    |
|   File "/home/superduper/.local/lib/python3.10/site-packages/superduper/base/apply.py", line 47, in apply                                                                                                                                  |
|     object.pre_create(db)                                                                                                                                                                                                                  |
|   File "/home/superduper/.local/lib/python3.10/site-packages/superduper/components/component.py", line 576, in pre_create                                                                                                                  |
|     self._pre_create(db)                                                                                                                                                                                                                   |
|   File "/home/superduper/.local/lib/python3.10/site-packages/superduper/components/template.py", line 124, in _pre_create                                                                                                                  |
|     db.artifact_store.save_artifact(self.template)                                                                                                                                                                                         |
|   File "/home/superduper/.local/lib/python3.10/site-packages/superduper/backends/base/artifacts.py", line 119, in save_artifact                                                                                                            |
|     self.put_file(file_path, file_id=file_id)                                                                                                                                                                                              |
|   File "/home/superduper/.local/lib/python3.10/site-packages/superduper/backends/local/artifacts.py", line 119, in put_file                                                                                                                |
|     shutil.copy(file_path, save_path)                                                                                                                                                                                                      |
|   File "/usr/lib/python3.10/shutil.py", line 417, in copy                                                                                                                                                                                  |
|     copyfile(src, dst, follow_symlinks=follow_symlinks)                                                                                                                                                                                    |
|   File "/usr/lib/python3.10/shutil.py", line 256, in copyfile                                                                                                                                                                              |
|     with open(dst, 'wb') as fdst:                                                                                                                                                                                                          |
| PermissionError: [Errno 13] Permission denied: '/artifacts/9c9e4b89367007582586a03565c5b6b43f070f1f/demo.py'  

This probably originates from the default permissions of os.makedirs from https://github.com/superduper-io/superduper/blob/main/superduper/backends/local/artifacts.py.

https://www.geeksforgeeks.org/python-os-makedirs-method/

Instead of Oo777 try with O777

superduper@statefulset-0:/artifacts$ mkdir -p -m 0o777 testdir/nested
mkdir: invalid mode '0o777'
superduper@statefulset-0:/artifacts$ mkdir -p -m 0777 testdir/nested
superduper@statefulset-0:/artifacts$ ls -laR testdir/
testdir/:
total 12
drwxrwxrwx. 1 root root 4096 Dec  4 14:05 .
drwxrwxrwx. 1 root root 4096 Jan  1  1970 ..
drwxrwxrwx. 1 root root 4096 Dec  4 14:07 nested

testdir/nested:
total 8
drwxrwxrwx. 1 root root 4096 Dec  4 14:07 .
drwxrwxrwx. 1 root root 4096 Dec  4 14:05 ..
-rw-r--r--. 1 root root    0 Dec  4 14:08 a
@fnikolai fnikolai added 🐛 bug Something isn't working mission critical labels Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working mission critical
Projects
None yet
Development

No branches or pull requests

1 participant