codalab 1.7.5__tar.gz → 1.7.7__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.
Files changed (177) hide show
  1. codalab-1.7.7/PKG-INFO +66 -0
  2. {codalab-1.7.5 → codalab-1.7.7}/codalab/common.py +1 -1
  3. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/beam/SQLiteIndexedTar.py +4 -2
  4. {codalab-1.7.5 → codalab-1.7.7}/codalab/server/rest_server.py +30 -0
  5. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/download_util.py +46 -38
  6. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/file_util.py +12 -7
  7. codalab-1.7.7/codalab.egg-info/PKG-INFO +66 -0
  8. {codalab-1.7.5 → codalab-1.7.7}/codalab.egg-info/entry_points.txt +0 -1
  9. {codalab-1.7.5 → codalab-1.7.7}/codalab.egg-info/requires.txt +1 -2
  10. {codalab-1.7.5 → codalab-1.7.7}/codalab_service.py +10 -1
  11. {codalab-1.7.5 → codalab-1.7.7}/docker_config/compose_files/docker-compose.yml +15 -2
  12. {codalab-1.7.5 → codalab-1.7.7}/docker_config/dockerfiles/Dockerfile.server +2 -2
  13. {codalab-1.7.5 → codalab-1.7.7}/docker_config/dockerfiles/Dockerfile.worker +2 -2
  14. {codalab-1.7.5 → codalab-1.7.7}/pyproject.toml +6 -0
  15. {codalab-1.7.5 → codalab-1.7.7}/requirements.txt +1 -2
  16. {codalab-1.7.5 → codalab-1.7.7}/setup.py +1 -1
  17. codalab-1.7.5/PKG-INFO +0 -18
  18. codalab-1.7.5/codalab.egg-info/PKG-INFO +0 -18
  19. {codalab-1.7.5 → codalab-1.7.7}/LICENSE.txt +0 -0
  20. {codalab-1.7.5 → codalab-1.7.7}/MANIFEST.in +0 -0
  21. {codalab-1.7.5 → codalab-1.7.7}/README.md +0 -0
  22. {codalab-1.7.5 → codalab-1.7.7}/codalab/__init__.py +0 -0
  23. {codalab-1.7.5 → codalab-1.7.7}/codalab/bin/__init__.py +0 -0
  24. {codalab-1.7.5 → codalab-1.7.7}/codalab/bin/bundle_manager.py +0 -0
  25. {codalab-1.7.5 → codalab-1.7.7}/codalab/bin/cl.py +0 -0
  26. {codalab-1.7.5 → codalab-1.7.7}/codalab/bin/server.py +0 -0
  27. {codalab-1.7.5 → codalab-1.7.7}/codalab/bin/ws_server.py +0 -0
  28. {codalab-1.7.5 → codalab-1.7.7}/codalab/bundles/__init__.py +0 -0
  29. {codalab-1.7.5 → codalab-1.7.7}/codalab/bundles/dataset_bundle.py +0 -0
  30. {codalab-1.7.5 → codalab-1.7.7}/codalab/bundles/derived_bundle.py +0 -0
  31. {codalab-1.7.5 → codalab-1.7.7}/codalab/bundles/make_bundle.py +0 -0
  32. {codalab-1.7.5 → codalab-1.7.7}/codalab/bundles/named_bundle.py +0 -0
  33. {codalab-1.7.5 → codalab-1.7.7}/codalab/bundles/private_bundle.py +0 -0
  34. {codalab-1.7.5 → codalab-1.7.7}/codalab/bundles/program_bundle.py +0 -0
  35. {codalab-1.7.5 → codalab-1.7.7}/codalab/bundles/run_bundle.py +0 -0
  36. {codalab-1.7.5 → codalab-1.7.7}/codalab/bundles/uploaded_bundle.py +0 -0
  37. {codalab-1.7.5 → codalab-1.7.7}/codalab/client/__init__.py +0 -0
  38. {codalab-1.7.5 → codalab-1.7.7}/codalab/client/json_api_client.py +0 -0
  39. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/__init__.py +0 -0
  40. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/beam/MultiReaderFileStream.py +0 -0
  41. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/beam/__init__.py +0 -0
  42. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/beam/blobstorageuploader.py +0 -0
  43. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/beam/filesystems.py +0 -0
  44. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/beam/mockblobstoragefilesystem.py +0 -0
  45. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/beam/streamingzipfile.py +0 -0
  46. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/bundle_action.py +0 -0
  47. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/bundle_cli.py +0 -0
  48. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/bundle_fuse.py +0 -0
  49. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/bundle_store.py +0 -0
  50. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/bundle_util.py +0 -0
  51. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/canonicalize.py +0 -0
  52. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/cli_util.py +0 -0
  53. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/codalab_manager.py +0 -0
  54. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/completers.py +0 -0
  55. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/crypt_util.py +0 -0
  56. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/download_manager.py +0 -0
  57. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/editor_util.py +0 -0
  58. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/emailer.py +0 -0
  59. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/file_util.py +0 -0
  60. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/formatting.py +0 -0
  61. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/interactive_session.py +0 -0
  62. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/metadata_defaults.py +0 -0
  63. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/metadata_util.py +0 -0
  64. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/path_util.py +0 -0
  65. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/print_util.py +0 -0
  66. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/profiling_util.py +0 -0
  67. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/server_util.py +0 -0
  68. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/spec_util.py +0 -0
  69. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/telemetry_util.py +0 -0
  70. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/ui_actions.py +0 -0
  71. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/unicode_util.py +0 -0
  72. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/upload_manager.py +0 -0
  73. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/worksheet_util.py +0 -0
  74. {codalab-1.7.5 → codalab-1.7.7}/codalab/lib/zip_util.py +0 -0
  75. {codalab-1.7.5 → codalab-1.7.7}/codalab/model/__init__.py +0 -0
  76. {codalab-1.7.5 → codalab-1.7.7}/codalab/model/bundle_model.py +0 -0
  77. {codalab-1.7.5 → codalab-1.7.7}/codalab/model/mysql_model.py +0 -0
  78. {codalab-1.7.5 → codalab-1.7.7}/codalab/model/orm_object.py +0 -0
  79. {codalab-1.7.5 → codalab-1.7.7}/codalab/model/sqlite_model.py +0 -0
  80. {codalab-1.7.5 → codalab-1.7.7}/codalab/model/tables.py +0 -0
  81. {codalab-1.7.5 → codalab-1.7.7}/codalab/model/util.py +0 -0
  82. {codalab-1.7.5 → codalab-1.7.7}/codalab/model/worker_model.py +0 -0
  83. {codalab-1.7.5 → codalab-1.7.7}/codalab/objects/__init__.py +0 -0
  84. {codalab-1.7.5 → codalab-1.7.7}/codalab/objects/bundle.py +0 -0
  85. {codalab-1.7.5 → codalab-1.7.7}/codalab/objects/dependency.py +0 -0
  86. {codalab-1.7.5 → codalab-1.7.7}/codalab/objects/metadata.py +0 -0
  87. {codalab-1.7.5 → codalab-1.7.7}/codalab/objects/metadata_spec.py +0 -0
  88. {codalab-1.7.5 → codalab-1.7.7}/codalab/objects/oauth2.py +0 -0
  89. {codalab-1.7.5 → codalab-1.7.7}/codalab/objects/permission.py +0 -0
  90. {codalab-1.7.5 → codalab-1.7.7}/codalab/objects/user.py +0 -0
  91. {codalab-1.7.5 → codalab-1.7.7}/codalab/objects/worksheet.py +0 -0
  92. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/__init__.py +0 -0
  93. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/account.py +0 -0
  94. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/bundle_actions.py +0 -0
  95. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/bundles.py +0 -0
  96. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/cli.py +0 -0
  97. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/groups.py +0 -0
  98. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/help.py +0 -0
  99. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/interpret.py +0 -0
  100. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/oauth2.py +0 -0
  101. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/schemas.py +0 -0
  102. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/users.py +0 -0
  103. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/util.py +0 -0
  104. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/workers.py +0 -0
  105. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/worksheet_block_schemas.py +0 -0
  106. {codalab-1.7.5 → codalab-1.7.7}/codalab/rest/worksheets.py +0 -0
  107. {codalab-1.7.5 → codalab-1.7.7}/codalab/server/__init__.py +0 -0
  108. {codalab-1.7.5 → codalab-1.7.7}/codalab/server/auth.py +0 -0
  109. {codalab-1.7.5 → codalab-1.7.7}/codalab/server/authenticated_plugin.py +0 -0
  110. {codalab-1.7.5 → codalab-1.7.7}/codalab/server/bundle_manager.py +0 -0
  111. {codalab-1.7.5 → codalab-1.7.7}/codalab/server/cookie.py +0 -0
  112. {codalab-1.7.5 → codalab-1.7.7}/codalab/server/json_api_plugin.py +0 -0
  113. {codalab-1.7.5 → codalab-1.7.7}/codalab/server/oauth2_provider.py +0 -0
  114. {codalab-1.7.5 → codalab-1.7.7}/codalab/server/worker_info_accessor.py +0 -0
  115. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/__init__.py +0 -0
  116. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/bundle_service_client.py +0 -0
  117. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/bundle_state.py +0 -0
  118. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/dependency_manager.py +0 -0
  119. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/docker_image_manager.py +0 -0
  120. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/docker_utils.py +0 -0
  121. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/fsm.py +0 -0
  122. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/image_manager.py +0 -0
  123. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/main.py +0 -0
  124. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/noop_image_manager.py +0 -0
  125. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/pyjson.py +0 -0
  126. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/reader.py +0 -0
  127. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/rest_client.py +0 -0
  128. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/runtime/__init__.py +0 -0
  129. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/runtime/kubernetes_runtime.py +0 -0
  130. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/singularity_image_manager.py +0 -0
  131. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/state_committer.py +0 -0
  132. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/tar_file_stream.py +0 -0
  133. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/tar_subdir_stream.py +0 -0
  134. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/un_gzip_stream.py +0 -0
  135. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/un_tar_directory.py +0 -0
  136. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/upload_util.py +0 -0
  137. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/worker.py +0 -0
  138. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/worker_monitoring.py +0 -0
  139. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/worker_run_state.py +0 -0
  140. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker/worker_thread.py +0 -0
  141. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker_manager/__init__.py +0 -0
  142. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker_manager/aws_batch_worker_manager.py +0 -0
  143. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker_manager/azure_batch_worker_manager.py +0 -0
  144. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker_manager/kubernetes_worker_manager.py +0 -0
  145. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker_manager/main.py +0 -0
  146. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker_manager/slurm_batch_worker_manager.py +0 -0
  147. {codalab-1.7.5 → codalab-1.7.7}/codalab/worker_manager/worker_manager.py +0 -0
  148. {codalab-1.7.5 → codalab-1.7.7}/codalab.egg-info/SOURCES.txt +0 -0
  149. {codalab-1.7.5 → codalab-1.7.7}/codalab.egg-info/dependency_links.txt +0 -0
  150. {codalab-1.7.5 → codalab-1.7.7}/codalab.egg-info/not-zip-safe +0 -0
  151. {codalab-1.7.5 → codalab-1.7.7}/codalab.egg-info/top_level.txt +0 -0
  152. {codalab-1.7.5 → codalab-1.7.7}/docker_config/.dockerignore +0 -0
  153. {codalab-1.7.5 → codalab-1.7.7}/docker_config/__init__.py +0 -0
  154. {codalab-1.7.5 → codalab-1.7.7}/docker_config/compose_files/__init__.py +0 -0
  155. {codalab-1.7.5 → codalab-1.7.7}/docker_config/compose_files/docker-compose.dev.yml +0 -0
  156. {codalab-1.7.5 → codalab-1.7.7}/docker_config/compose_files/docker-compose.ssl.yml +0 -0
  157. {codalab-1.7.5 → codalab-1.7.7}/docker_config/compose_files/files/__init__.py +0 -0
  158. {codalab-1.7.5 → codalab-1.7.7}/docker_config/compose_files/files/nginx.conf +0 -0
  159. {codalab-1.7.5 → codalab-1.7.7}/docker_config/compose_files/files/nginx.conf.ssl +0 -0
  160. {codalab-1.7.5 → codalab-1.7.7}/docker_config/compose_files/files/wait-for-it.sh +0 -0
  161. {codalab-1.7.5 → codalab-1.7.7}/docker_config/dockerfiles/Dockerfile.default-cpu +0 -0
  162. {codalab-1.7.5 → codalab-1.7.7}/docker_config/dockerfiles/Dockerfile.default-gpu +0 -0
  163. {codalab-1.7.5 → codalab-1.7.7}/docker_config/dockerfiles/Dockerfile.frontend +0 -0
  164. {codalab-1.7.5 → codalab-1.7.7}/docker_config/dockerfiles/__init__.py +0 -0
  165. {codalab-1.7.5 → codalab-1.7.7}/rc +0 -0
  166. {codalab-1.7.5 → codalab-1.7.7}/scripts/__init__.py +0 -0
  167. {codalab-1.7.5 → codalab-1.7.7}/scripts/competitiond.py +0 -0
  168. {codalab-1.7.5 → codalab-1.7.7}/scripts/create-root-user.py +0 -0
  169. {codalab-1.7.5 → codalab-1.7.7}/scripts/create_sample_worksheet.py +0 -0
  170. {codalab-1.7.5 → codalab-1.7.7}/scripts/gen-cli-docs.py +0 -0
  171. {codalab-1.7.5 → codalab-1.7.7}/scripts/gen-rest-docs.py +0 -0
  172. {codalab-1.7.5 → codalab-1.7.7}/scripts/initialize-azurite.py +0 -0
  173. {codalab-1.7.5 → codalab-1.7.7}/scripts/migrate-disk-to-blob.py +0 -0
  174. {codalab-1.7.5 → codalab-1.7.7}/scripts/send-email-notifications.py +0 -0
  175. {codalab-1.7.5 → codalab-1.7.7}/scripts/test_util.py +0 -0
  176. {codalab-1.7.5 → codalab-1.7.7}/scripts/upload-mlcomp.py +0 -0
  177. {codalab-1.7.5 → codalab-1.7.7}/setup.cfg +0 -0
codalab-1.7.7/PKG-INFO ADDED
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: codalab
3
+ Version: 1.7.7
4
+ Summary: CLI for CodaLab, a platform for reproducible computation
5
+ Home-page: https://github.com/codalab/codalab-worksheets
6
+ Author: CodaLab
7
+ Author-email: codalab.worksheets@gmail.com
8
+ License: Apache License 2.0
9
+ Keywords: codalab reproducible computation worksheets competitions
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Requires-Python: ~=3.9
14
+ License-File: LICENSE.txt
15
+ Requires-Dist: wheel==0.43.0
16
+ Requires-Dist: apache-beam[azure]==2.38.0
17
+ Requires-Dist: cachetools<5,>=3.1.0
18
+ Requires-Dist: google-apitools<0.5.32,>=0.5.31
19
+ Requires-Dist: google-auth<3,>=1.18.0
20
+ Requires-Dist: bottle==0.12.20
21
+ Requires-Dist: docker==4.3.0
22
+ Requires-Dist: marshmallow-jsonapi==0.15.1
23
+ Requires-Dist: marshmallow==2.15.1
24
+ Requires-Dist: setuptools<80,>=40.0.0
25
+ Requires-Dist: argcomplete==1.12.3
26
+ Requires-Dist: indexed_gzip==1.7.0
27
+ Requires-Dist: ratarmountcore==0.1.3
28
+ Requires-Dist: PyYAML==6.0.1
29
+ Requires-Dist: psutil==5.7.2
30
+ Requires-Dist: six==1.15.0
31
+ Requires-Dist: SQLAlchemy==1.3.19
32
+ Requires-Dist: watchdog>=2.0.0
33
+ Requires-Dist: fusepy==2.0.4
34
+ Requires-Dist: pygments<2.13,>=2.12
35
+ Requires-Dist: click==8.0.2
36
+ Requires-Dist: python-dateutil==2.8.1
37
+ Requires-Dist: selenium==3.141.0
38
+ Requires-Dist: requests==2.25.0
39
+ Requires-Dist: azure-storage-blob==12.4.0
40
+ Requires-Dist: azure-core==1.8.0
41
+ Requires-Dist: sentry-sdk==1.14.0
42
+ Requires-Dist: requests-oauthlib==1.1.0
43
+ Requires-Dist: oauthlib==2.1.0
44
+ Requires-Dist: markdown2==2.4.0
45
+ Requires-Dist: urllib3==1.26.11
46
+ Requires-Dist: retry==0.9.2
47
+ Requires-Dist: spython==0.1.14
48
+ Requires-Dist: flufl.lock==6.0
49
+ Requires-Dist: websockets==9.1
50
+ Requires-Dist: kubernetes==12.0.1
51
+ Requires-Dist: google-cloud-storage==2.0.0
52
+ Requires-Dist: httpio==0.3.0
53
+ Requires-Dist: memory_profiler==0.61.0
54
+ Dynamic: author
55
+ Dynamic: author-email
56
+ Dynamic: classifier
57
+ Dynamic: description
58
+ Dynamic: home-page
59
+ Dynamic: keywords
60
+ Dynamic: license
61
+ Dynamic: license-file
62
+ Dynamic: requires-dist
63
+ Dynamic: requires-python
64
+ Dynamic: summary
65
+
66
+ Visit https://worksheets.codalab.org/ or setup your own server by following the instructions in the documentation (https://codalab-worksheets.readthedocs.io/en/latest/Server-Setup).
@@ -29,7 +29,7 @@ from codalab.lib.beam.filesystems import (
29
29
 
30
30
  # Increment this on master when ready to cut a release.
31
31
  # http://semver.org/
32
- CODALAB_VERSION = '1.7.5'
32
+ CODALAB_VERSION = '1.7.7'
33
33
  BINARY_PLACEHOLDER = '<binary>'
34
34
  URLOPEN_TIMEOUT_SECONDS = int(os.environ.get('CODALAB_URLOPEN_TIMEOUT_SECONDS', 5 * 60))
35
35
 
@@ -1476,7 +1476,8 @@ class SQLiteIndexedTar(MountSource):
1476
1476
  # against this. Therefore, collate all error checking by catching exceptions.
1477
1477
 
1478
1478
  try:
1479
- gzindex = tempfile.mkstemp(dir=tmpDir)[1]
1479
+ fd, gzindex = tempfile.mkstemp(dir=tmpDir)
1480
+ os.close(fd) # Only the path is needed; leaking the fd pins the file on disk after removal.
1480
1481
  with open(gzindex, 'wb') as file:
1481
1482
  if 'gzipindexes' in tables:
1482
1483
  # Try to read index files containing very large gzip indexes
@@ -1520,7 +1521,8 @@ class SQLiteIndexedTar(MountSource):
1520
1521
  # Therefore, try different paths, starting with the location where the index resides.
1521
1522
  gzindex = None
1522
1523
  for tmpDir in [os.path.dirname(self.indexFilePath), None]:
1523
- gzindex = tempfile.mkstemp(dir=tmpDir)[1]
1524
+ fd, gzindex = tempfile.mkstemp(dir=tmpDir)
1525
+ os.close(fd) # Only the path is needed; leaking the fd pins the file on disk after removal.
1524
1526
  try:
1525
1527
  fileObject.export_index(filename=gzindex)
1526
1528
  break
@@ -5,7 +5,9 @@ import os
5
5
  import sys
6
6
  import textwrap
7
7
  import traceback
8
+ import ctypes
8
9
  import logging
10
+ import time
9
11
 
10
12
  import bottle
11
13
  import sentry_sdk
@@ -229,6 +231,28 @@ def dummy_xmlrpc_app():
229
231
  return app
230
232
 
231
233
 
234
+ # glibc keeps memory that Python has freed in per-thread malloc arenas instead of returning it to the OS.
235
+ # With many threads serving large blob reads / gzip streams, the REST server's RSS grows by many GB even
236
+ # though there is no leak of live objects. Periodically asking malloc to trim its arenas releases it.
237
+ MALLOC_TRIM_INTERVAL_SECONDS = 30
238
+ _last_malloc_trim = 0.0
239
+
240
+
241
+ def release_free_memory(now=None):
242
+ """Returns freed heap memory to the OS (glibc only; a no-op elsewhere). Rate limited to once per
243
+ MALLOC_TRIM_INTERVAL_SECONDS per process. Returns True if a trim was performed."""
244
+ global _last_malloc_trim
245
+ now = time.monotonic() if now is None else now
246
+ if now - _last_malloc_trim < MALLOC_TRIM_INTERVAL_SECONDS:
247
+ return False
248
+ _last_malloc_trim = now
249
+ try:
250
+ ctypes.CDLL('libc.so.6').malloc_trim(0)
251
+ except (OSError, AttributeError):
252
+ return False
253
+ return True
254
+
255
+
232
256
  def create_rest_app(manager=CodaLabManager()):
233
257
  """Creates and returns a rest app."""
234
258
  install(SaveEnvironmentPlugin(manager))
@@ -253,6 +277,7 @@ def create_rest_app(manager=CodaLabManager()):
253
277
 
254
278
  root_app = Bottle()
255
279
  root_app.mount('/rest', default_app())
280
+ root_app.add_hook('after_request', release_free_memory)
256
281
 
257
282
  # Look for templates in codalab-worksheets/views
258
283
  bottle.TEMPLATE_PATH = [
@@ -276,6 +301,7 @@ def run_rest_server(manager, debug, num_processes, num_threads):
276
301
  # We use gunicorn to create a server with multiple processes, since in
277
302
  # Python a single process uses at most 1 CPU due to the Global Interpreter
278
303
  # Lock.
304
+ max_requests = int(os.environ.get('CODALAB_REST_MAX_REQUESTS', 20000))
279
305
  sys.argv = sys.argv[:1] # Small hack to work around a Gunicorn arg parsing
280
306
  # bug. None of the arguments to cl should go to
281
307
  # Gunicorn.
@@ -290,4 +316,8 @@ def run_rest_server(manager, debug, num_processes, num_threads):
290
316
  threads=num_threads,
291
317
  worker_tmp_dir='/tmp', # don't use globally set tempdir
292
318
  timeout=5 * 60,
319
+ # Recycle each worker after this many requests (with jitter so that workers don't all restart at
320
+ # once) to bound memory growth. Set CODALAB_REST_MAX_REQUESTS=0 to disable.
321
+ max_requests=max_requests,
322
+ max_requests_jitter=max_requests // 10,
293
323
  )
@@ -183,6 +183,49 @@ def _compute_target_info_local(path: str, depth: Union[int, float]) -> TargetInf
183
183
  return result
184
184
 
185
185
 
186
+ def _get_archive_target_info(
187
+ tf: Any, path: str, depth: Union[int, float], process_contents: Any
188
+ ) -> TargetInfo:
189
+ """Gets the target info of the specified path within an opened indexed archive (tf).
190
+ If the specified path is a directory and additional depth is requested, this
191
+ function is recursively called to retrieve the target info of files within
192
+ the directory, much like _compute_target_info_local.
193
+
194
+ This is a module-level function (rather than a recursive closure) on purpose: a
195
+ recursive closure references itself through its closure cell, creating a reference
196
+ cycle that also captures tf. That kept every opened archive (its SQLite index
197
+ connection, temp files and in-memory gzip index) alive until the cyclic garbage
198
+ collector happened to run, leaking memory and disk on the REST server.
199
+ """
200
+ if not path.startswith("/"):
201
+ path = "/" + path
202
+ finfo = cast(FileInfo, tf.getFileInfo(path))
203
+ if finfo is None:
204
+ # Not found
205
+ raise PathException("File not found.")
206
+ result: TargetInfo = {
207
+ 'name': os.path.basename(path), # get last part of path
208
+ 'size': finfo.size,
209
+ 'perm': finfo.mode & 0o777,
210
+ 'type': '',
211
+ }
212
+ if stat.S_ISLNK(finfo.mode):
213
+ result['type'] = 'link'
214
+ result['link'] = finfo.linkname
215
+ elif not stat.S_ISDIR(finfo.mode):
216
+ result['type'] = 'file'
217
+ else:
218
+ result['type'] = 'directory'
219
+ if depth > 0:
220
+ listing = cast(Dict[str, FileInfo], tf.listDir(path) or {})
221
+ result['contents'] = process_contents(
222
+ _get_archive_target_info(tf, path + "/" + file_name, depth - 1, process_contents)
223
+ for file_name in listing
224
+ if file_name != "."
225
+ )
226
+ return result
227
+
228
+
186
229
  def _compute_target_info_blob(
187
230
  path: str, depth: Union[int, float], return_generators=False
188
231
  ) -> TargetInfo:
@@ -216,44 +259,9 @@ def _compute_target_info_blob(
216
259
  process_contents = list if return_generators is False else lambda x: x
217
260
 
218
261
  with OpenIndexedArchiveFile(linked_bundle_path.bundle_path) as tf:
219
- islink = lambda finfo: stat.S_ISLNK(finfo.mode)
220
- readlink = lambda finfo: finfo.linkname
221
- isfile = lambda finfo: not stat.S_ISDIR(finfo.mode)
222
- isdir = lambda finfo: stat.S_ISDIR(finfo.mode)
223
- listdir = lambda path: cast(Dict[str, FileInfo], tf.listDir(path) or {})
224
-
262
+ # Non-recursive wrapper; see _get_archive_target_info for why recursion lives at module level.
225
263
  def _get_info(path: str, depth: Union[int, float]) -> TargetInfo:
226
- """This function is called to get the target info of the specified path.
227
- If the specified path is a directory and additional depth is requested, this
228
- function is recursively called to retrieve the target info of files within
229
- the directory, much like _compute_target_info_local.
230
- """
231
- if not path.startswith("/"):
232
- path = "/" + path
233
- finfo = cast(FileInfo, tf.getFileInfo(path))
234
- if finfo is None:
235
- # Not found
236
- raise PathException("File not found.")
237
- result: TargetInfo = {
238
- 'name': os.path.basename(path), # get last part of path
239
- 'size': finfo.size,
240
- 'perm': finfo.mode & 0o777,
241
- 'type': '',
242
- }
243
- if islink(finfo):
244
- result['type'] = 'link'
245
- result['link'] = readlink(finfo)
246
- elif isfile(finfo):
247
- result['type'] = 'file'
248
- elif isdir(finfo):
249
- result['type'] = 'directory'
250
- if depth > 0:
251
- result['contents'] = process_contents(
252
- _get_info(path + "/" + file_name, depth - 1)
253
- for file_name in listdir(path)
254
- if file_name != "."
255
- )
256
- return result
264
+ return _get_archive_target_info(tf, path, depth, process_contents)
257
265
 
258
266
  if not linked_bundle_path.is_archive_dir:
259
267
  # Return the contents of the single .gz file.
@@ -290,7 +298,7 @@ def _compute_target_info_blob(
290
298
  if depth > 0:
291
299
  result['contents'] = process_contents(
292
300
  _get_info(file_name, depth - 1)
293
- for file_name in listdir("/")
301
+ for file_name in cast(Dict[str, FileInfo], tf.listDir("/") or {})
294
302
  if file_name != "."
295
303
  )
296
304
  return result
@@ -217,13 +217,18 @@ class OpenIndexedArchiveFile(object):
217
217
  )
218
218
 
219
219
  def __enter__(self) -> SQLiteIndexedTar:
220
- return SQLiteIndexedTar(
221
- fileObject=self.f,
222
- tarFileName="contents",
223
- writeIndex=False,
224
- clearIndexCache=False,
225
- indexFilePath=self.index_file_name,
226
- )
220
+ try:
221
+ return SQLiteIndexedTar(
222
+ fileObject=self.f,
223
+ tarFileName="contents",
224
+ writeIndex=False,
225
+ clearIndexCache=False,
226
+ indexFilePath=self.index_file_name,
227
+ )
228
+ except Exception:
229
+ # __exit__ is not called when __enter__ raises, so clean up the temp index here.
230
+ os.remove(self.index_file_name)
231
+ raise
227
232
 
228
233
  def __exit__(self, type, value, traceback):
229
234
  os.remove(self.index_file_name)
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: codalab
3
+ Version: 1.7.7
4
+ Summary: CLI for CodaLab, a platform for reproducible computation
5
+ Home-page: https://github.com/codalab/codalab-worksheets
6
+ Author: CodaLab
7
+ Author-email: codalab.worksheets@gmail.com
8
+ License: Apache License 2.0
9
+ Keywords: codalab reproducible computation worksheets competitions
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Requires-Python: ~=3.9
14
+ License-File: LICENSE.txt
15
+ Requires-Dist: wheel==0.43.0
16
+ Requires-Dist: apache-beam[azure]==2.38.0
17
+ Requires-Dist: cachetools<5,>=3.1.0
18
+ Requires-Dist: google-apitools<0.5.32,>=0.5.31
19
+ Requires-Dist: google-auth<3,>=1.18.0
20
+ Requires-Dist: bottle==0.12.20
21
+ Requires-Dist: docker==4.3.0
22
+ Requires-Dist: marshmallow-jsonapi==0.15.1
23
+ Requires-Dist: marshmallow==2.15.1
24
+ Requires-Dist: setuptools<80,>=40.0.0
25
+ Requires-Dist: argcomplete==1.12.3
26
+ Requires-Dist: indexed_gzip==1.7.0
27
+ Requires-Dist: ratarmountcore==0.1.3
28
+ Requires-Dist: PyYAML==6.0.1
29
+ Requires-Dist: psutil==5.7.2
30
+ Requires-Dist: six==1.15.0
31
+ Requires-Dist: SQLAlchemy==1.3.19
32
+ Requires-Dist: watchdog>=2.0.0
33
+ Requires-Dist: fusepy==2.0.4
34
+ Requires-Dist: pygments<2.13,>=2.12
35
+ Requires-Dist: click==8.0.2
36
+ Requires-Dist: python-dateutil==2.8.1
37
+ Requires-Dist: selenium==3.141.0
38
+ Requires-Dist: requests==2.25.0
39
+ Requires-Dist: azure-storage-blob==12.4.0
40
+ Requires-Dist: azure-core==1.8.0
41
+ Requires-Dist: sentry-sdk==1.14.0
42
+ Requires-Dist: requests-oauthlib==1.1.0
43
+ Requires-Dist: oauthlib==2.1.0
44
+ Requires-Dist: markdown2==2.4.0
45
+ Requires-Dist: urllib3==1.26.11
46
+ Requires-Dist: retry==0.9.2
47
+ Requires-Dist: spython==0.1.14
48
+ Requires-Dist: flufl.lock==6.0
49
+ Requires-Dist: websockets==9.1
50
+ Requires-Dist: kubernetes==12.0.1
51
+ Requires-Dist: google-cloud-storage==2.0.0
52
+ Requires-Dist: httpio==0.3.0
53
+ Requires-Dist: memory_profiler==0.61.0
54
+ Dynamic: author
55
+ Dynamic: author-email
56
+ Dynamic: classifier
57
+ Dynamic: description
58
+ Dynamic: home-page
59
+ Dynamic: keywords
60
+ Dynamic: license
61
+ Dynamic: license-file
62
+ Dynamic: requires-dist
63
+ Dynamic: requires-python
64
+ Dynamic: summary
65
+
66
+ Visit https://worksheets.codalab.org/ or setup your own server by following the instructions in the documentation (https://codalab-worksheets.readthedocs.io/en/latest/Server-Setup).
@@ -7,4 +7,3 @@ cl-worker = codalab.worker.main:main
7
7
  cl-worker-manager = codalab.worker_manager.main:main
8
8
  cl-ws-server = codalab.bin.ws_server:main
9
9
  codalab-service = codalab_service:main
10
-
@@ -7,7 +7,7 @@ bottle==0.12.20
7
7
  docker==4.3.0
8
8
  marshmallow-jsonapi==0.15.1
9
9
  marshmallow==2.15.1
10
- setuptools>=40.0.0
10
+ setuptools<80,>=40.0.0
11
11
  argcomplete==1.12.3
12
12
  indexed_gzip==1.7.0
13
13
  ratarmountcore==0.1.3
@@ -20,7 +20,6 @@ fusepy==2.0.4
20
20
  pygments<2.13,>=2.12
21
21
  click==8.0.2
22
22
  python-dateutil==2.8.1
23
- diffimg==0.2.3
24
23
  selenium==3.141.0
25
24
  requests==2.25.0
26
25
  azure-storage-blob==12.4.0
@@ -21,6 +21,7 @@ from __future__ import print_function
21
21
  import argparse
22
22
  import errno
23
23
  import os
24
+ import shutil
24
25
  import socket
25
26
  import subprocess
26
27
  import yaml
@@ -856,9 +857,17 @@ class CodalabServiceManager(object):
856
857
  print('')
857
858
  return success
858
859
 
860
+ @staticmethod
861
+ def _compose_binary():
862
+ """Use the legacy `docker-compose` if installed, else the `docker compose` plugin.
863
+ `--compatibility` keeps the v1 container names (e.g. codalab_rest-server_1) that tests rely on,
864
+ and applies the `deploy.resources.limits` in the compose file (e.g. the rest-server memory cap)."""
865
+ return 'docker-compose --compatibility' if shutil.which('docker-compose') else 'docker compose --compatibility'
866
+
859
867
  def _run_compose_cmd(self, cmd):
860
868
  compose_files_str = ' '.join('-f ' + f for f in self.compose_files)
861
- command_string = 'docker-compose -p %s --project-directory %s %s %s' % (
869
+ command_string = '%s -p %s --project-directory %s %s %s' % (
870
+ self._compose_binary(),
862
871
  self.args.instance_name,
863
872
  self.compose_cwd,
864
873
  compose_files_str,
@@ -122,6 +122,14 @@ services:
122
122
  command: cl-server
123
123
  <<: *codalab-base
124
124
  <<: *codalab-server
125
+ restart: unless-stopped
126
+ # Cap memory so that a runaway rest-server worker is killed (and respawned by gunicorn) instead of
127
+ # taking the whole host, including mysql, down with the kernel OOM killer.
128
+ # Applied via `docker-compose --compatibility` (see codalab_service.py).
129
+ deploy:
130
+ resources:
131
+ limits:
132
+ memory: 8G
125
133
  depends_on:
126
134
  - mysql
127
135
  - ws-server
@@ -141,6 +149,7 @@ services:
141
149
  - rest-server
142
150
  expose:
143
151
  - ${CODALAB_WS_PORT}
152
+ restart: unless-stopped
144
153
 
145
154
  bundle-manager:
146
155
  image: codalab/server:${CODALAB_VERSION}
@@ -153,6 +162,7 @@ services:
153
162
  - mysql
154
163
  networks:
155
164
  - rest-server
165
+ restart: unless-stopped
156
166
 
157
167
  azurite:
158
168
  image: mcr.microsoft.com/azure-storage/azurite:3.14.2
@@ -310,7 +320,7 @@ services:
310
320
  <<: *codalab-server
311
321
  volumes:
312
322
  - "${CODALAB_HOME}:${CODALAB_HOME}"
313
- - ${CODALAB_WORKER_MANAGER_CPU_KUBERNETES_CERT_PATH}:${CODALAB_WORKER_MANAGER_CPU_KUBERNETES_CERT_PATH}:ro
323
+ - ${CODALAB_WORKER_MANAGER_CPU_KUBERNETES_CERT_PATH:-/dev/null}:${CODALAB_WORKER_MANAGER_CPU_KUBERNETES_CERT_PATH:-/dev/null}:ro
314
324
  networks:
315
325
  - rest-server
316
326
 
@@ -345,7 +355,7 @@ services:
345
355
  <<: *codalab-server
346
356
  volumes:
347
357
  - "${CODALAB_HOME}:${CODALAB_HOME}"
348
- - ${CODALAB_WORKER_MANAGER_GPU_KUBERNETES_CERT_PATH}:${CODALAB_WORKER_MANAGER_GPU_KUBERNETES_CERT_PATH}:ro
358
+ - ${CODALAB_WORKER_MANAGER_GPU_KUBERNETES_CERT_PATH:-/dev/null}:${CODALAB_WORKER_MANAGER_GPU_KUBERNETES_CERT_PATH:-/dev/null}:ro
349
359
  networks:
350
360
  - rest-server
351
361
 
@@ -358,6 +368,7 @@ services:
358
368
  - rest-server
359
369
  networks:
360
370
  - rest-server
371
+ restart: unless-stopped
361
372
 
362
373
  nginx:
363
374
  image: nginx:1.12.0
@@ -374,6 +385,7 @@ services:
374
385
  - ./files/nginx.conf:/etc/nginx/nginx.conf:ro
375
386
  networks:
376
387
  - rest-server
388
+ restart: unless-stopped
377
389
 
378
390
  mysql:
379
391
  # https://hub.docker.com/_/mysql
@@ -388,6 +400,7 @@ services:
388
400
  - ${CODALAB_MYSQL_MOUNT}:/var/lib/mysql
389
401
  networks:
390
402
  - rest-server
403
+ restart: unless-stopped
391
404
 
392
405
  worker:
393
406
  image: codalab/worker:${CODALAB_VERSION}
@@ -42,12 +42,12 @@ COPY requirements.txt requirements.txt
42
42
  COPY requirements.docs.txt requirements.docs.txt
43
43
  COPY requirements.dev.txt requirements.dev.txt
44
44
  COPY requirements-server.txt requirements-server.txt
45
- RUN python3 -m pip install setuptools --upgrade
45
+ RUN python3 -m pip install "setuptools<80" --upgrade
46
46
  RUN python3 -m pip install --no-cache-dir -r requirements-server.txt
47
47
 
48
48
  # Install code
49
49
  COPY setup.py setup.py
50
- RUN python3 -m pip install --no-cache-dir -e .
50
+ RUN python3 -m pip install --no-cache-dir --no-build-isolation -e .
51
51
  COPY alembic alembic
52
52
  COPY alembic.ini alembic.ini
53
53
  COPY codalab codalab
@@ -38,12 +38,12 @@ RUN mkdir ${WORKDIR}/scripts
38
38
  # Install dependencies
39
39
  COPY requirements.txt requirements.txt
40
40
  RUN python3 -m pip install --user --upgrade pip==20.3.4; \
41
- python3 -m pip install setuptools --upgrade; \
41
+ python3 -m pip install "setuptools<80" --upgrade; \
42
42
  python3 -m pip install --no-cache-dir -r requirements.txt;
43
43
 
44
44
  # Install code
45
45
  COPY setup.py setup.py
46
- RUN python3 -m pip install --no-cache-dir -e .
46
+ RUN python3 -m pip install --no-cache-dir --no-build-isolation -e .
47
47
  COPY codalab/lib codalab/lib
48
48
  COPY codalab/worker codalab/worker
49
49
  COPY codalab/common.py codalab/common.py
@@ -1,5 +1,11 @@
1
1
  # Configuration file for using Black for Codalab
2
2
 
3
+ [build-system]
4
+ # setuptools>=80 `develop` shells out to pip (and 82 removed pkg_resources),
5
+ # which breaks `pip install -e .` in an isolated build env.
6
+ requires = ["setuptools>=40.8.0,<80", "wheel"]
7
+ build-backend = "setuptools.build_meta:__legacy__"
8
+
3
9
  [tool.black]
4
10
  line-length = 100
5
11
  skip-string-normalization = true
@@ -14,7 +14,7 @@ bottle==0.12.20
14
14
  docker==4.3.0
15
15
  marshmallow-jsonapi==0.15.1
16
16
  marshmallow==2.15.1
17
- setuptools>=40.0.0
17
+ setuptools>=40.0.0,<80
18
18
  argcomplete==1.12.3
19
19
  indexed_gzip==1.7.0
20
20
  ratarmountcore==0.1.3
@@ -27,7 +27,6 @@ fusepy==2.0.4
27
27
  pygments>=2.12,<2.13
28
28
  click==8.0.2
29
29
  python-dateutil==2.8.1
30
- diffimg==0.2.3
31
30
  selenium==3.141.0
32
31
  requests==2.25.0
33
32
  azure-storage-blob==12.4.0
@@ -7,7 +7,7 @@ import sys
7
7
 
8
8
 
9
9
  # should match codalab/common.py#CODALAB_VERSION
10
- CODALAB_VERSION = "1.7.5"
10
+ CODALAB_VERSION = "1.7.7"
11
11
 
12
12
 
13
13
  class Install(install):
codalab-1.7.5/PKG-INFO DELETED
@@ -1,18 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: codalab
3
- Version: 1.7.5
4
- Summary: CLI for CodaLab, a platform for reproducible computation
5
- Home-page: https://github.com/codalab/codalab-worksheets
6
- Author: CodaLab
7
- Author-email: codalab.worksheets@gmail.com
8
- License: Apache License 2.0
9
- Keywords: codalab reproducible computation worksheets competitions
10
- Platform: UNKNOWN
11
- Classifier: Programming Language :: Python :: 3 :: Only
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Requires-Python: ~=3.9
15
- License-File: LICENSE.txt
16
-
17
- Visit https://worksheets.codalab.org/ or setup your own server by following the instructions in the documentation (https://codalab-worksheets.readthedocs.io/en/latest/Server-Setup).
18
-
@@ -1,18 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: codalab
3
- Version: 1.7.5
4
- Summary: CLI for CodaLab, a platform for reproducible computation
5
- Home-page: https://github.com/codalab/codalab-worksheets
6
- Author: CodaLab
7
- Author-email: codalab.worksheets@gmail.com
8
- License: Apache License 2.0
9
- Keywords: codalab reproducible computation worksheets competitions
10
- Platform: UNKNOWN
11
- Classifier: Programming Language :: Python :: 3 :: Only
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Requires-Python: ~=3.9
15
- License-File: LICENSE.txt
16
-
17
- Visit https://worksheets.codalab.org/ or setup your own server by following the instructions in the documentation (https://codalab-worksheets.readthedocs.io/en/latest/Server-Setup).
18
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes