Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

conf.py 2.2 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  1. """
  2. Define paths to all DVC dependency and output files.
  3. """
  4. from pathlib import Path
  5. from urllib.parse import urlparse
  6. import dask
  7. from dvc.repo import Repo
  8. dvc_repo = Repo('.')
  9. # Get DVC remote URL to your remote work directory for this project
  10. remote_user_work_path = urlparse(
  11. dvc_repo.config.config[f'remote "ahsoka_user_workspace"']['url']).path
  12. remote_user_work_path = Path(remote_user_work_path)
  13. remote_project_work_path = urlparse(
  14. dvc_repo.config.config[f'remote "ahsoka_project_data"']['url']).path
  15. remote_project_work_folder_name = Path(remote_project_work_path).name
  16. remote_work_path = remote_user_work_path/remote_project_work_folder_name
  17. # Get DVC remote URL to the project cache
  18. remote_cache_path = urlparse(
  19. dvc_repo.config.config[f'remote "ahsoka_project_cache"']['url']).path
  20. remote_cache_path = Path(remote_cache_path)
  21. assert remote_work_path.name == remote_cache_path.name, (
  22. 'The name of your remote DVC data directory for this project:'
  23. f'"{remote_work_path.name}", is should be the same as the same as the name'
  24. f'of the project cache directory: "{remote_cache_path.name}')
  25. data_dir = remote_work_path
  26. @dask.delayed
  27. def remote_mkdir(folder_path):
  28. """
  29. Create the given folder on the remote server with the correct permissions.
  30. Create a folder on the remote dask worker server. The mode and permissions
  31. of the folder is set to "2770". The SGID "2" ensures that new files in the
  32. folder will be create with the same group permissions as the folder itself.
  33. The umask "770" ensures that both the user and the group members have read,
  34. write, and execute permissions to the folder and its files, where as all
  35. other user have no permissions.
  36. Parameters
  37. ----------
  38. folder_path : pathlib.Path
  39. Path to the folder you wishes to create with the correct permissions.
  40. Returns
  41. -------
  42. folder : pathlib.Path
  43. Path to the folder which have been create with the correct permissions,
  44. if the folder already existed we assume it has the correct permissions
  45. as we may do not have permissions to change its permissions.
  46. """
  47. if not folder_path.exists():
  48. folder_path.mkdir()
  49. folder_path.chmod(mode=0o2770)
  50. return folder_path
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...