ciocore 7.0.2b5__py2.py3-none-any.whl → 8.0.0__py2.py3-none-any.whl

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.

Potentially problematic release.


This version of ciocore might be problematic. Click here for more details.

Files changed (111) hide show
  1. ciocore/VERSION +1 -1
  2. ciocore/__init__.py +23 -1
  3. ciocore/api_client.py +422 -156
  4. ciocore/cli.py +503 -0
  5. ciocore/common.py +10 -1
  6. ciocore/config.py +86 -53
  7. ciocore/data.py +20 -73
  8. ciocore/docsite/404.html +723 -0
  9. ciocore/docsite/apidoc/api_client/index.html +3203 -0
  10. ciocore/docsite/apidoc/apidoc/index.html +868 -0
  11. ciocore/docsite/apidoc/config/index.html +1591 -0
  12. ciocore/docsite/apidoc/data/index.html +1480 -0
  13. ciocore/docsite/apidoc/hardware_set/index.html +2367 -0
  14. ciocore/docsite/apidoc/package_environment/index.html +1450 -0
  15. ciocore/docsite/apidoc/package_tree/index.html +2310 -0
  16. ciocore/docsite/assets/_mkdocstrings.css +16 -0
  17. ciocore/docsite/assets/images/favicon.png +0 -0
  18. ciocore/docsite/assets/javascripts/bundle.4e31edb1.min.js +29 -0
  19. ciocore/docsite/assets/javascripts/bundle.4e31edb1.min.js.map +8 -0
  20. ciocore/docsite/assets/javascripts/lunr/min/lunr.ar.min.js +1 -0
  21. ciocore/docsite/assets/javascripts/lunr/min/lunr.da.min.js +18 -0
  22. ciocore/docsite/assets/javascripts/lunr/min/lunr.de.min.js +18 -0
  23. ciocore/docsite/assets/javascripts/lunr/min/lunr.du.min.js +18 -0
  24. ciocore/docsite/assets/javascripts/lunr/min/lunr.es.min.js +18 -0
  25. ciocore/docsite/assets/javascripts/lunr/min/lunr.fi.min.js +18 -0
  26. ciocore/docsite/assets/javascripts/lunr/min/lunr.fr.min.js +18 -0
  27. ciocore/docsite/assets/javascripts/lunr/min/lunr.hi.min.js +1 -0
  28. ciocore/docsite/assets/javascripts/lunr/min/lunr.hu.min.js +18 -0
  29. ciocore/docsite/assets/javascripts/lunr/min/lunr.hy.min.js +1 -0
  30. ciocore/docsite/assets/javascripts/lunr/min/lunr.it.min.js +18 -0
  31. ciocore/docsite/assets/javascripts/lunr/min/lunr.ja.min.js +1 -0
  32. ciocore/docsite/assets/javascripts/lunr/min/lunr.jp.min.js +1 -0
  33. ciocore/docsite/assets/javascripts/lunr/min/lunr.kn.min.js +1 -0
  34. ciocore/docsite/assets/javascripts/lunr/min/lunr.ko.min.js +1 -0
  35. ciocore/docsite/assets/javascripts/lunr/min/lunr.multi.min.js +1 -0
  36. ciocore/docsite/assets/javascripts/lunr/min/lunr.nl.min.js +18 -0
  37. ciocore/docsite/assets/javascripts/lunr/min/lunr.no.min.js +18 -0
  38. ciocore/docsite/assets/javascripts/lunr/min/lunr.pt.min.js +18 -0
  39. ciocore/docsite/assets/javascripts/lunr/min/lunr.ro.min.js +18 -0
  40. ciocore/docsite/assets/javascripts/lunr/min/lunr.ru.min.js +18 -0
  41. ciocore/docsite/assets/javascripts/lunr/min/lunr.sa.min.js +1 -0
  42. ciocore/docsite/assets/javascripts/lunr/min/lunr.stemmer.support.min.js +1 -0
  43. ciocore/docsite/assets/javascripts/lunr/min/lunr.sv.min.js +18 -0
  44. ciocore/docsite/assets/javascripts/lunr/min/lunr.ta.min.js +1 -0
  45. ciocore/docsite/assets/javascripts/lunr/min/lunr.te.min.js +1 -0
  46. ciocore/docsite/assets/javascripts/lunr/min/lunr.th.min.js +1 -0
  47. ciocore/docsite/assets/javascripts/lunr/min/lunr.tr.min.js +18 -0
  48. ciocore/docsite/assets/javascripts/lunr/min/lunr.vi.min.js +1 -0
  49. ciocore/docsite/assets/javascripts/lunr/min/lunr.zh.min.js +1 -0
  50. ciocore/docsite/assets/javascripts/lunr/tinyseg.js +206 -0
  51. ciocore/docsite/assets/javascripts/lunr/wordcut.js +6708 -0
  52. ciocore/docsite/assets/javascripts/workers/search.dfff1995.min.js +42 -0
  53. ciocore/docsite/assets/javascripts/workers/search.dfff1995.min.js.map +8 -0
  54. ciocore/docsite/assets/stylesheets/main.83068744.min.css +1 -0
  55. ciocore/docsite/assets/stylesheets/main.83068744.min.css.map +1 -0
  56. ciocore/docsite/assets/stylesheets/palette.ecc896b0.min.css +1 -0
  57. ciocore/docsite/assets/stylesheets/palette.ecc896b0.min.css.map +1 -0
  58. ciocore/docsite/cmdline/docs/index.html +834 -0
  59. ciocore/docsite/cmdline/downloader/index.html +897 -0
  60. ciocore/docsite/cmdline/packages/index.html +841 -0
  61. ciocore/docsite/cmdline/uploader/index.html +950 -0
  62. ciocore/docsite/how-to-guides/index.html +831 -0
  63. ciocore/docsite/index.html +853 -0
  64. ciocore/docsite/logo.png +0 -0
  65. ciocore/docsite/objects.inv +0 -0
  66. ciocore/docsite/search/search_index.json +1 -0
  67. ciocore/docsite/sitemap.xml +3 -0
  68. ciocore/docsite/sitemap.xml.gz +0 -0
  69. ciocore/docsite/stylesheets/extra.css +26 -0
  70. ciocore/docsite/stylesheets/tables.css +167 -0
  71. ciocore/downloader/__init__.py +0 -0
  72. ciocore/downloader/base_downloader.py +644 -0
  73. ciocore/downloader/download_runner_base.py +47 -0
  74. ciocore/downloader/job_downloader.py +119 -0
  75. ciocore/{downloader.py → downloader/legacy_downloader.py} +0 -1
  76. ciocore/downloader/log.py +73 -0
  77. ciocore/downloader/logging_download_runner.py +87 -0
  78. ciocore/downloader/perpetual_downloader.py +63 -0
  79. ciocore/downloader/registry.py +97 -0
  80. ciocore/downloader/reporter.py +135 -0
  81. ciocore/file_utils.py +3 -3
  82. ciocore/hardware_set.py +0 -4
  83. ciocore/package_environment.py +67 -75
  84. ciocore/package_query.py +171 -0
  85. ciocore/package_tree.py +300 -377
  86. ciocore/retry.py +0 -0
  87. ciocore/uploader/_uploader.py +205 -152
  88. {ciocore-7.0.2b5.dist-info → ciocore-8.0.0.dist-info}/METADATA +34 -16
  89. ciocore-8.0.0.dist-info/RECORD +127 -0
  90. {ciocore-7.0.2b5.dist-info → ciocore-8.0.0.dist-info}/WHEEL +1 -1
  91. ciocore-8.0.0.dist-info/entry_points.txt +2 -0
  92. tests/extra_env_fixtures.py +57 -0
  93. tests/instance_type_fixtures.py +42 -8
  94. tests/project_fixtures.py +8 -0
  95. tests/test_api_client.py +121 -2
  96. tests/test_base_downloader.py +104 -0
  97. tests/test_cli.py +163 -0
  98. tests/test_common.py +8 -8
  99. tests/test_config.py +23 -9
  100. tests/test_data.py +144 -160
  101. tests/test_downloader.py +118 -0
  102. tests/test_hardware_set.py +69 -20
  103. tests/test_job_downloader.py +213 -0
  104. ciocore/__about__.py +0 -10
  105. ciocore/cli/__init__.py +0 -3
  106. ciocore/cli/conductor.py +0 -210
  107. ciocore-7.0.2b5.data/scripts/conductor +0 -19
  108. ciocore-7.0.2b5.data/scripts/conductor.bat +0 -13
  109. ciocore-7.0.2b5.dist-info/RECORD +0 -51
  110. tests/mocks/api_client_mock.py +0 -31
  111. {ciocore-7.0.2b5.dist-info → ciocore-8.0.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ciocore
3
- Version: 7.0.2b5
3
+ Version: 8.0.0
4
4
  Summary: Core functionality for Conductor's client tools
5
5
  Home-page: https://github.com/ConductorTechnologies/ciocore
6
6
  Author: conductor
@@ -9,21 +9,22 @@ Classifier: Operating System :: OS Independent
9
9
  Classifier: Programming Language :: Python
10
10
  Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: certifi ==2019.11.28
12
+ Requires-Dist: requests[use_chardet_on_py3] ==2.28.1
13
13
  Requires-Dist: pyjwt ==1.7.1
14
- Requires-Dist: requests <=2.25.1,>=2.10.0
15
14
  Requires-Dist: future >=0.18.2
16
- Requires-Dist: urllib3 ==1.25.11
15
+ Requires-Dist: cioseq <1.0.0,>=0.4.1
16
+ Requires-Dist: Click <9.0.0,>=8.1.3
17
+ Requires-Dist: markdown <4.0.0,>=3.5.2
18
+ Requires-Dist: colorlog <7.0.0,>=6.8.2
17
19
 
18
- # Conductor Core
20
+ ## Introduction
19
21
 
20
- Use the command-line uploader and downloader or develop your own tools using the Python API.
22
+ Conductor Core is a Python package that provides an API and a command-line interface for interacting with Conductor.
21
23
 
22
24
  ## Install
23
25
 
24
- **To install the latest version.**
25
26
  ```bash
26
- pip install --upgrade ciocore
27
+ pip install ciocore
27
28
  ```
28
29
 
29
30
  Run the conductor command to confirm the package was installed.
@@ -31,6 +32,13 @@ Run the conductor command to confirm the package was installed.
31
32
  conductor --help
32
33
  ```
33
34
 
35
+ Get help for a specific sub command
36
+ ```bash
37
+ conductor downloader --help
38
+ conductor uploader --help
39
+ conductor software --help
40
+ ```
41
+
34
42
  Example API usage
35
43
  ```python
36
44
  from ciocore import api_client
@@ -43,14 +51,24 @@ See [CONTRIBUTING](CONTRIBUTING.md)
43
51
 
44
52
  ## Changelog
45
53
 
46
- ## Unreleased:
47
- * 7.0.2-beta.5
48
- * fix bug in package tree where the platform was not being set correctly
49
- * make tests runnable in python 2.7
50
- * make all tests pass in python 2.7 and 3.9
51
- * 7.0.2-beta.3
52
- * rewrite inst type descriptions
53
- * filter out bad 3dsmax entries from the packages
54
+ ## Version:8.0.0 -- 07 Apr 2024
55
+
56
+ * The `conductor` commandline interface (CLI) has undergone a complete overhaul to improve its functionality and performance. It is now installed as a Python console script, which simplifies the installation process on all platforms and ensures that the tool is always accessible. In addition, this standardized installation allows for better integration into our Companion application and potentially customers' own proprietary tools.
57
+ * The commandline downloader has been rewritten to improve its performance and reliability. In previous versions, the downloader would fetch all download URLs from the server before starting any downloads. This approach was inefficient and would lead to performance issues when handling jobs with large numbers of tasks. The new downloader fetches tasks in small batches, which allows the download to start almost immediately, regardless of the number of tasks. It provides several new commandline flags, such as filtering based on filenames, and better logging, giving users more control and visibility over the download process. In addition, the new downloader has been written as an event based system that can be seamlessly integrated into other pipeline tools and GUIs. Pipeline TDs need only to register handlers to any of the events that the downloader emits.
58
+ * The `conductor` commandline now supports a new subcommand, `docs`, which opens API and commandline documentation in a local web browser. The documentation is generated using `mkdocs` and is included in the package. This command is useful as it ensures the **API** documentation is relevant to the version of the tool being used.
59
+ * The `conductor` commandline now supports a new subcommand, `packages`, which displays all available software packages on Conductor's cloud. The command can output the document as text, markdown, or nicely formatted HTML. The data is pulled from the Conductor server and is always up-to-date.
60
+ * The Python API now provides four new endpoints: `kill_tasks`, `kill_jobs`, `get_jobs`, and `get_log`.
61
+ * The Python API now provides access to entries in the Dashboard's Extra Environment Variables section. This feature allows administrators to set environment variables that are passed to all jobs run on the cloud. It's useful for setting up access to license servers or other shared resources. The API is open to clients so that they may insert account-widse variables with the correct level of precedence.
62
+ * In addition, the environment variable schema has been extended to support a merge policy of `prepend`. This policy allows users to add new values to the beginning of the list of values for an environment variable and is useful for search paths.
63
+
64
+
65
+ ## Version:7.0.2 -- 10 Nov 2023
66
+
67
+ * Bug fix: Fixed an issue where a list was copied with a Python3 only construct.
68
+ * Compatibility improvement: Tests can now be run in Python 2.7 as well.
69
+ * Cross-version support: Ensured that all tests pass successfully in both Python 2.7 and 3.9.
70
+ * Improvement: Rewrite instance type descriptions on the client. Ensure uniqueness.
71
+ * Workaround: Removed invalid 3dsmax entries from the packages response.
54
72
 
55
73
  ## Version:7.0.1 -- 30 Oct 2023
56
74
 
@@ -0,0 +1,127 @@
1
+ ciocore/VERSION,sha256=aiaXYaVWcRcFJ54x0J1ICf_ev0aM-5SwdkDiuIfIUqU,5
2
+ ciocore/__init__.py,sha256=aTP7LeeosQA8BZE67gDV4jgfTK5zxmwZRjiTRu_ZWj0,646
3
+ ciocore/api_client.py,sha256=TyHXGmK4uTmKV93O_IpAvttZhbexIIZTGP-IVn_WyWM,24599
4
+ ciocore/cli.py,sha256=9OdoazUovfUHxpiAHahH7HJjJcdRLO0_QsdPXjGjlW8,15509
5
+ ciocore/client_db.py,sha256=tTz3bl2xeDPPcYSDS3g3QgV_xYihJMx0Kj6OeN2klK0,12978
6
+ ciocore/common.py,sha256=mBIS6KiYoQsjWe6aIFUGRRvCMl8BIN2kmLZ4J8icap8,14982
7
+ ciocore/compat.py,sha256=5uEXPSog_jxsDMaHBswAKEtfyXT25VgU6WNGIhz9PHU,256
8
+ ciocore/conductor_submit.py,sha256=ONE0LsA5hGavTJIOXXYx8qzl8_vBPADwhd6Ytq_0E0c,9382
9
+ ciocore/config.py,sha256=rCL7kaFn1tYgSglN8q9Wx6SwMpoXTq0BMQGwPRVwVIg,8973
10
+ ciocore/data.py,sha256=Ji0qUk8nJXBNakoHSqBiVx8O58SbZXyt273SHlEDn3U,7027
11
+ ciocore/exceptions.py,sha256=4Oq-WX-qiN6kPUdBCHvvd6mtSQ0nCkDbJxWt2CNtpv8,1504
12
+ ciocore/file_utils.py,sha256=swA7th9WhDEloW69YViRTKB-oeC9UmNdEGegfH1r-Gw,17176
13
+ ciocore/hardware_set.py,sha256=FlRQiGCLRcSW7Oko_gzgVK8ZqJ_J92eT8e_AleAbS2E,17047
14
+ ciocore/loggeria.py,sha256=2xdQRFb9NyXynU2O_pSOszJWcpoHgPwTUWJvERg7ODY,15251
15
+ ciocore/package_environment.py,sha256=MEHV7jfs3NJIEYCIaW8JfJdBmelvPHZMmBzPlXETiRo,7808
16
+ ciocore/package_query.py,sha256=2m5EBXfu1lmqupZrFF8f8mfkX_PgijpdMxCtFI5e5s0,5574
17
+ ciocore/package_tree.py,sha256=vkORKXxQ7dO8l0_96eFwm-5AUVL0rP9bhgWYhW_v3lo,15649
18
+ ciocore/post_install.py,sha256=zu5Ctz2ANbKD-f5G2ODLIhKkWENBi4F3UKKu50OEWrg,1000
19
+ ciocore/retry.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ ciocore/validator.py,sha256=f_K7gxz122W_i5AxVx6dKhckOygl8TnmQiVj7tyX5zw,2344
21
+ ciocore/worker.py,sha256=h6JophGBWqLdLdvphlzkkVMt0ojLw7_1Vrz4dikPRYE,21743
22
+ ciocore/auth/__init__.py,sha256=cdS-xZzMq41yXM5cz8sUlcYgo8CJYh8HcCCWmhbDgf0,606
23
+ ciocore/auth/server.py,sha256=8btX9-EokUl6q55V8muDmEV2tvvbTBD0BHeWFbwkzUc,3892
24
+ ciocore/docsite/404.html,sha256=DQCrQsaKh8M0zlCFZmjFHUtqy7_gx_i2Rpc3OoDdDI4,17207
25
+ ciocore/docsite/index.html,sha256=p_Dq_6_8cwZZPDI5zjahfCWUkfbSj14NJtoQFAZv0WI,20945
26
+ ciocore/docsite/logo.png,sha256=gArgFFWdw8w985-0TkuGIgU_pW9sziEMZdqytXb5WLo,2825
27
+ ciocore/docsite/objects.inv,sha256=s2FKStLlVIQbfG7U2-nw-7rz4unvd1W0u00YtLBxAKo,758
28
+ ciocore/docsite/sitemap.xml,sha256=M_V85zl0y2adRvzJAnoCxlZH_Hl7TLnIb1A-6l_xGmI,109
29
+ ciocore/docsite/sitemap.xml.gz,sha256=DLMqiMagzHE-fj8auM7l5Hw-22HXwKT5x6XfgNtEg28,127
30
+ ciocore/docsite/apidoc/api_client/index.html,sha256=mHDq-zdWuilDKUluzmQNdOsImRoGEnnK5Ul2ApajgdU,170218
31
+ ciocore/docsite/apidoc/apidoc/index.html,sha256=NQn8wjapxa7O2IQhsbE7Y-VMfMFL6Tby-L7qIF6K3m4,26171
32
+ ciocore/docsite/apidoc/config/index.html,sha256=1GWkyClM7LJlLBpx07BqCi3xDkU-SKVPjNUEeKuwbNs,72559
33
+ ciocore/docsite/apidoc/data/index.html,sha256=9DonjpASPYZGYRHjyaodkK3AxSlTHsvm1xdq2cqMxPI,50850
34
+ ciocore/docsite/apidoc/hardware_set/index.html,sha256=DMlpzQCy2ypJ078tcFNrZAvG2sU7P5-ZwU4ZRCObtQg,123042
35
+ ciocore/docsite/apidoc/package_environment/index.html,sha256=M2L6Pu00jYj5AdhHQXrNZjOKVWCXYtgL8I34zL6B0i4,69248
36
+ ciocore/docsite/apidoc/package_tree/index.html,sha256=wKW5dsHBlcDyvCGakSNzYHX8z99F1Vhu2NyqAW6c1ko,109393
37
+ ciocore/docsite/assets/_mkdocstrings.css,sha256=K3bqYEmxlOHQ3-M11JNbBWHCBDBLarkFRm8HuEYrAG4,341
38
+ ciocore/docsite/assets/images/favicon.png,sha256=AjhUxD_Eslt5XuSVHIAZ494Fk__rb5GLXR8qm0elfP4,1870
39
+ ciocore/docsite/assets/javascripts/bundle.4e31edb1.min.js,sha256=vMxCR_BtNIcbmbPV6j8Z-YDLQ9ckt4RzvGuzCTg034s,97250
40
+ ciocore/docsite/assets/javascripts/bundle.4e31edb1.min.js.map,sha256=8Oyq3j4kjJ2wbHtEGTiDI5Svk1xp2kEnoKKUiYA_geM,890964
41
+ ciocore/docsite/assets/javascripts/lunr/tinyseg.js,sha256=GwRMI5YQ72X87_YDlWdEK7FpLUE_Xuhob-6BsaMGd2E,22878
42
+ ciocore/docsite/assets/javascripts/lunr/wordcut.js,sha256=PTj95orzSJFSiORe6zOK-CVshhH6LP7zB-arlYCLNWc,677463
43
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.ar.min.js,sha256=iaHcsJSoSR2WjBUaslSgMZXIf_KtqiQIx2mSgoSEcSU,17074
44
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.da.min.js,sha256=KhJzQEjq504KBeXBCP3yTCtx382NpxIzbKnj0nq5KVY,4654
45
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.de.min.js,sha256=vKp8XBm8cwwFu5HiKuDjhuGsSgWAxCt9lPm4dXqtras,6119
46
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.du.min.js,sha256=RS2gT-RJucZcYThP7FgtxjgkvU5Vn64sOSaneQto6XY,6208
47
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.es.min.js,sha256=3sTskL1vR4yj5lY2qOP-31ErI9AaUaAdfngi9n67qvg,11499
48
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.fi.min.js,sha256=aBVB_PWxmHrYsAdm6cBjiez5nD166Bf6iR-SP2kbhmg,9342
49
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.fr.min.js,sha256=TdVqolUedwrSbvS4UJLNMUR2ceDoSzlRQnhUf1QXc3c,10669
50
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.hi.min.js,sha256=Yx__UuNiPy37o1rwdsa4taRQ7v_jClz6x0WNq3fL4KY,3383
51
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.hu.min.js,sha256=h2yWm79KK4Rzj04KFJIu4zHLfCGTpiH2Xbf4Nv3TOjg,9437
52
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.hy.min.js,sha256=DvvLkCvbfsDd3_peK6NHt0xJ_8X0P9c__tg1KOuhLpU,1264
53
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.it.min.js,sha256=AKUHPfLpIuX97RxaTUARrsAkcqudkYKnxlCNYLYlxFM,11232
54
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.ja.min.js,sha256=xP3tMI9jNoGm7VO2wQ2MpZFv39UPa4LskU1yW-DLi9Y,2313
55
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.jp.min.js,sha256=BBFO3DbcEU7c5a-7PH95X0XHfYZzwe3NylZ13atdUZk,36
56
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.kn.min.js,sha256=oGTQ10ODNJV6RCtiYUD7cvTt6OvhfrXE4laC2HyIu_g,3494
57
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.ko.min.js,sha256=c9G9sd5K72xZIPUWkkxascRA21Cm9cYSa9D7fPXTdmQ,7972
58
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.multi.min.js,sha256=l2H0da5582Qg_3FN-ZUO-yZO_8-SMO_VW1EaDeiZ6Xk,817
59
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.nl.min.js,sha256=OZ7ybWHtLVgG9Y6nI9-soJ9KfJtR4xW90XSCyOMBOj4,6026
60
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.no.min.js,sha256=V_nbkpD57TYIB1X1PuNCoE9VpZVOSt2RXRwwGjdGRXM,4754
61
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.pt.min.js,sha256=OiXSq6ojBjzxP8VsGa5MxQUMtiFRFenQj0pvS3h4AGc,10171
62
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.ro.min.js,sha256=z6JqjqQpPYHoVHuiMh1wOg_piB8HIfyl8zo_gL8Vbuk,10958
63
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.ru.min.js,sha256=UO88D6tKPy0mDolzxjNjqg3PArVZ6p0R1fArYZdYXBc,10331
64
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.sa.min.js,sha256=QcVYpDVcPq6PCieuhwcSc48UsL2IA4BCrIq4tBHlgX8,4901
65
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.stemmer.support.min.js,sha256=LnITYFhGoYAU7HUJEMsYqKTGC7IyABA7P62e8nsQxwU,3647
66
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.sv.min.js,sha256=lCsWW8yCGOMkb8RzWvmxwvZlFDZtAAC-BRvxu4ltQT4,4523
67
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.ta.min.js,sha256=F6MtxJwnydJ5RWJafo0GbUL2TqHOWls03kJ3I_v5rio,2406
68
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.te.min.js,sha256=B5yPzwKK7vOI6Y7IYHyOpQupZgxGeXyKEZ0F-PggWDg,2330
69
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.th.min.js,sha256=NIRhJmhD4xayaCAASpbT_YehV5gp0kTOUQwXKT7vBDk,1031
70
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.tr.min.js,sha256=6L9XsQM7i9kuoEqUxTMBWqGn8KjWgwGUuXTpTh5Kyjw,15009
71
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.vi.min.js,sha256=LjnD_XMF9uZvwEJHlqdpbLjjbcD1w6g-obxE3-P-y1Y,784
72
+ ciocore/docsite/assets/javascripts/lunr/min/lunr.zh.min.js,sha256=2MW3LDbsnDGXYCVG6bpbV62j9yXVZKVRvxbquvtUjog,2158
73
+ ciocore/docsite/assets/javascripts/workers/search.dfff1995.min.js,sha256=dSn8S0AZNSnDklowowFe_v5geq6WOXg3zQiH_JuRUTY,39431
74
+ ciocore/docsite/assets/javascripts/workers/search.dfff1995.min.js.map,sha256=WRu84gT6TJxoh21TdmByytMRPpYv8PHzHKdSvS1psrM,214982
75
+ ciocore/docsite/assets/stylesheets/main.83068744.min.css,sha256=gwaHRErdgDoSsYabs3TkMGBpuUc9kTXNLWwucSPCqZ0,122334
76
+ ciocore/docsite/assets/stylesheets/main.83068744.min.css.map,sha256=q8dWQkgGSfCcYT2Le1J0Tmxpcqxol5kZKaokp9d8Af0,42278
77
+ ciocore/docsite/assets/stylesheets/palette.ecc896b0.min.css,sha256=7MiWsGpIt19TLduugHr1OQv1TJ9rEsndnkc2V8D9VjM,12245
78
+ ciocore/docsite/assets/stylesheets/palette.ecc896b0.min.css.map,sha256=T8ZT8Mw8ws4vxyx_b1QAwyC9_pnv7r0KVaUdu2ST7ug,3639
79
+ ciocore/docsite/cmdline/docs/index.html,sha256=2SFe5X1oq58UDuYBvUXCcgSBseP5AMgfu-ldKKK1WXA,20051
80
+ ciocore/docsite/cmdline/downloader/index.html,sha256=DAVErhWEPuEtkQr7y9D_wjylzM9j4nWIWvTi4_gMoaA,23171
81
+ ciocore/docsite/cmdline/packages/index.html,sha256=j1YeMgdwZ6FyJGJii05AdtUWKRjyu1fOr3_bKJsLfEU,20923
82
+ ciocore/docsite/cmdline/uploader/index.html,sha256=y0728lIAYC4b9mfpjNVfwQqXoqJrsdG49UY5u7B1p94,25123
83
+ ciocore/docsite/how-to-guides/index.html,sha256=OFrFBTb9tuMn60Jd4oeM10Mw-d-0pyqwoKoo9g1biBM,20100
84
+ ciocore/docsite/search/search_index.json,sha256=ZMAbHLAlwOTujgA32XJTA7SHogRYh9i-ioPFOxjjJ0s,182633
85
+ ciocore/docsite/stylesheets/extra.css,sha256=_Cxe9Dhg1BBi6Kqaz_iZD9z9VyqxA9vtONRjP4PVic0,354
86
+ ciocore/docsite/stylesheets/tables.css,sha256=LE_zwGRxGcdPIy-9QiVPecOzlEBSqZb_WP5vDkFE0ZM,3235
87
+ ciocore/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
+ ciocore/downloader/base_downloader.py,sha256=9PVmP1qy-dop4MbVsmLFvf5W6LKQLUKHPDYE6AEt71g,25784
89
+ ciocore/downloader/download_runner_base.py,sha256=cWTWKhFX5FLG84Wh8_s7xpk3n0nmQ4fDiD2rYV6a3u0,1612
90
+ ciocore/downloader/job_downloader.py,sha256=HAhr95RyCsj3KTp5W58Znc4JmqHY-mrM5b8vo6kRIJ0,5697
91
+ ciocore/downloader/legacy_downloader.py,sha256=LIbT3BxuY56lq_UW_io9FSgK_2VIKwFVMENyF-5KllA,51158
92
+ ciocore/downloader/log.py,sha256=WCRNx0LObx8JBO5MQucNHQGBXMgSBLGdH0VALN8dFDo,2105
93
+ ciocore/downloader/logging_download_runner.py,sha256=iOuW8OvfAYW5MpP9zpUXh94qkWLC0GeG4PDGH7JSqJM,2865
94
+ ciocore/downloader/perpetual_downloader.py,sha256=cD7lnBH75-c-ZVVPHZc1vSnDhgJOnGlPT85zn7IjGgA,2105
95
+ ciocore/downloader/registry.py,sha256=_JIOuqpWkJkgJGN33nt-DCvqN9Gw3xeFhzPq4RUxIoE,2903
96
+ ciocore/downloader/reporter.py,sha256=p1NK9k6iQ-jt7lRvZR0xFz0cGb2yo8tQcjlvYKR9SWM,4501
97
+ ciocore/uploader/__init__.py,sha256=hxRFJf5Lo86rtRObFXSjjot8nybQd-SebSfYCbgZwow,24
98
+ ciocore/uploader/_uploader.py,sha256=AaCwRo1rGkdMA-XACx9k4Z73R97ndJUVMemUZNV-Ark,37353
99
+ ciocore/uploader/upload_stats/__init__.py,sha256=Lg1y4zq1i0cwc6Hh2K1TAQDYymLff49W-uIo1xjcvdI,5309
100
+ ciocore/uploader/upload_stats/stats_formats.py,sha256=giNirtObU66VALWghPFSRhg3q_vw5MvESsnXhb_I3y8,2402
101
+ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
+ tests/extra_env_fixtures.py,sha256=8qvU4d8SXGKzRVNR5whVqKCQOwOVMiFVfbKBAjxa2gE,1119
103
+ tests/instance_type_fixtures.py,sha256=uIzQduqKQVgjllMuyXaYnRC-pwqk5lnTx3NY2M5Nujo,4320
104
+ tests/package_fixtures.py,sha256=CsJnhB7oYzIxJH7b1tCOPyvnnVSCqEbSPhtCnsHL-nA,5070
105
+ tests/project_fixtures.py,sha256=iBm_th_JtAw76vlNu7Jjhh9tLH4oOaNi-MgtPzCV7yQ,138
106
+ tests/test_api_client.py,sha256=tnYkIYvDILGJRatZM0nrtr83x8yBJstMP0Rt151U2gI,6757
107
+ tests/test_base_downloader.py,sha256=SS7tWKv2ZZhpUDk4UCg1TkrNrpntjSewgzLl1mEubSE,3603
108
+ tests/test_cli.py,sha256=yWWGLip8WgnDAB0vg7uhBU5eeEJieFLQ78Pn7IN-uWI,6088
109
+ tests/test_common.py,sha256=tY_-SY-JmJX09UehFs9RIDqZ785AmhfTl6eVKJeIUFY,763
110
+ tests/test_config.py,sha256=-_G682Ss3Zr1FmcMkjla1zAZprX2tQKpKc5_wD28rII,13340
111
+ tests/test_data.py,sha256=NIBXpCjG3Os3vpc1CkiVONrebro8D_jqQyJ0N3kbucU,5433
112
+ tests/test_downloader.py,sha256=hceljsjnuvk5Vk5X4mHgavIEcpbv8ylPwpz7rTwJ-aE,4721
113
+ tests/test_hardware_set.py,sha256=hW7A_suyYdU7WkB7qoHSBPLxaAP2CKqI0i_ULfO5GeY,4408
114
+ tests/test_imports_2and3.py,sha256=ehqpRYPVY7djBcb8OT_cnh86iCJJ9wuMWnfSR9RHxmY,507
115
+ tests/test_job_downloader.py,sha256=_dZqyLZhc2Bq2n7-skERfodHx1JgFyHw8TamHp6ID9I,7025
116
+ tests/test_package_environment.py,sha256=CdiC2PDVSnbcwTb4fsDTWqGYSzs1n5ca2KMoyISckGA,5893
117
+ tests/test_package_tree.py,sha256=xCwNwYUmJrfmgCP2FGoHRFG-L0JPy8s4-66icxAls4o,6780
118
+ tests/test_submit.py,sha256=-ORI75pWzFGKUCkqHuPzaMxkK7qGh1zuAOMcTQ6Q1Hk,4940
119
+ tests/test_uploader.py,sha256=B1llTJt_fqR6e_V_Jxfw9z73QgkFlEPU87xLYGzt-TQ,2914
120
+ tests/test_validator.py,sha256=2fY66ayNc08PGyj2vTI-V_1yeCWJDngkj2zkUM5TTCI,1526
121
+ tests/mocks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
+ tests/mocks/glob.py,sha256=J2MH7nqi6NJOHuGdVWxhfeBd700_Ckj6cLh_8jSNkfg,215
123
+ ciocore-8.0.0.dist-info/METADATA,sha256=8iBZp-N5NyE1NnpPJccLrL4LPQHjDuetVnKEsb-Gk-Y,18155
124
+ ciocore-8.0.0.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
125
+ ciocore-8.0.0.dist-info/entry_points.txt,sha256=cCqcALMYbC4d8545V9w0Zysfg9MVuKWhzDQ2er4UfGE,47
126
+ ciocore-8.0.0.dist-info/top_level.txt,sha256=SvlM5JlqULzAz00JZWfiUhfjhqDzYzSWssA87zdJl0o,14
127
+ ciocore-8.0.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ conductor = ciocore.cli:main
@@ -0,0 +1,57 @@
1
+
2
+
3
+ EXTRA_ENV = [
4
+ {
5
+ "account_id": "6649535867387904",
6
+ "env": [],
7
+ },
8
+ {
9
+ "account_id": "5767615549800448",
10
+ "env": [
11
+ {
12
+ "merge_policy": "prepend",
13
+ "name": "test",
14
+ "value": "test"
15
+ }
16
+ ],
17
+ },
18
+ {
19
+ "account_id": "6649535867387904",
20
+ "env": [],
21
+ },
22
+ {
23
+ "account_id": "5669544198668288",
24
+ "env": [
25
+ {
26
+ "merge_policy": "append",
27
+ "name": "PATH",
28
+ "value": "/path/to/scripts"
29
+ },
30
+ {
31
+ "merge_policy": "exclusive",
32
+ "name": "RENDER_LOCATION",
33
+ "value": "cloud"
34
+ },
35
+ {
36
+ "merge_policy": "exclusive",
37
+ "name": "VARIABLE_USED_IN_SCRIPTS",
38
+ "value": "true"
39
+ },
40
+ {
41
+ "merge_policy": "exclusive",
42
+ "name": "testvar",
43
+ "value": "somevalue"
44
+ }
45
+ ],
46
+ },
47
+ {
48
+ "account_id": "6649535867387904",
49
+ "env": [
50
+ {
51
+ "merge_policy": "exclusive",
52
+ "name": "JMEYER",
53
+ "value": "JMEYER_ENV_VALUE"
54
+ }
55
+ ],
56
+ }
57
+ ]
@@ -55,12 +55,46 @@ WIN_INSTANCE_TYPES = [
55
55
 
56
56
  ALL_INSTANCE_TYPES = WIN_INSTANCE_TYPES + LIN_INSTANCE_TYPES
57
57
 
58
+ AWS_INSTANCE_TYPES = [
59
+ {
60
+ "cloud": "aws",
61
+ "cpu": 72,
62
+ "memory": 144,
63
+ "name": "c5.18xlarge",
64
+ "orchestrator": "batch",
65
+ "operating_system": "linux",
66
+ "cores": 72,
67
+ "description": "c5 18xlarge",
68
+ },
69
+ {
70
+ "cloud": "aws",
71
+ "cpu": 2,
72
+ "memory": 8,
73
+ "name": "m5.large",
74
+ "orchestrator": "batch",
75
+ "operating_system": "linux",
76
+ "cores": 2,
77
+ "description": "m large",
78
+ },
79
+ {
80
+ "cloud": "aws",
81
+ "cpu": 4,
82
+ "memory": 16,
83
+ "name": "m5.xlarge",
84
+ "orchestrator": "batch",
85
+ "operating_system": "linux",
86
+ "cores": 4,
87
+ "description": "m5 xlarge",
88
+ }
89
+ ]
90
+
91
+
58
92
 
59
93
  CW_INSTANCE_TYPES = [
60
94
  {
61
95
  "cores": 4,
62
96
  "memory": 16,
63
- "name": "a-4-16",
97
+ "name": "cw-a-4-16",
64
98
  "categories": [{"label": "low", "order": 1}, {"label": "extra", "order": 9}],
65
99
  "operating_system": "linux",
66
100
  "description": "Desc 4 C 16 M A",
@@ -68,7 +102,7 @@ CW_INSTANCE_TYPES = [
68
102
  {
69
103
  "cores": 8,
70
104
  "memory": 16,
71
- "name": "b-8-16",
105
+ "name": "cw-b-8-16",
72
106
  "categories": [{"label": "low", "order": 1}],
73
107
  "operating_system": "linux",
74
108
  "description": "Desc 8 C 16 M B",
@@ -76,7 +110,7 @@ CW_INSTANCE_TYPES = [
76
110
  {
77
111
  "cores": 4,
78
112
  "memory": 32,
79
- "name": "c-4-32",
113
+ "name": "cw-c-4-32",
80
114
  "categories": [{"label": "mid", "order": 2}, {"label": "extra", "order": 9}],
81
115
  "operating_system": "linux",
82
116
  "description": "Desc 4 C 32 M C",
@@ -84,7 +118,7 @@ CW_INSTANCE_TYPES = [
84
118
  {
85
119
  "cores": 8,
86
120
  "memory": 32,
87
- "name": "d-8-32",
121
+ "name": "cw-d-8-32",
88
122
  "categories": [{"label": "mid", "order": 2}],
89
123
  "operating_system": "linux",
90
124
  "description": "Desc 8 C 32 M D",
@@ -92,7 +126,7 @@ CW_INSTANCE_TYPES = [
92
126
  {
93
127
  "cores": 4,
94
128
  "memory": 64,
95
- "name": "e-4-32",
129
+ "name": "cw-e-4-32",
96
130
  "categories": [{"label": "high", "order": 3}, {"label": "extra", "order": 9}],
97
131
  "operating_system": "linux",
98
132
  "description": "Desc 4 C 32 M E",
@@ -100,7 +134,7 @@ CW_INSTANCE_TYPES = [
100
134
  {
101
135
  "cores": 8,
102
136
  "memory": 64,
103
- "name": "f-8-32",
137
+ "name": "cw-f-8-32",
104
138
  "categories": [{"label": "high", "order": 3}],
105
139
  "operating_system": "linux",
106
140
  "description": "Desc 8 C 32 M F",
@@ -108,7 +142,7 @@ CW_INSTANCE_TYPES = [
108
142
  {
109
143
  "cores": 8,
110
144
  "memory": 64,
111
- "name": "g-8-32",
145
+ "name": "cw-g-8-32",
112
146
  "categories": None,
113
147
  "operating_system": "linux",
114
148
  "description": "Desc 8 C 32 M G",
@@ -119,7 +153,7 @@ CW_INSTANCE_TYPES_WITH_GPUS = [
119
153
  {
120
154
  "cores": 8,
121
155
  "memory": 64,
122
- "name": "f-8-32-gpu",
156
+ "name": "cw-f-8-32-gpu",
123
157
  "categories": [{"label": "high", "order": 3}],
124
158
  "operating_system": "linux",
125
159
  "description": "Desc 8 C 32 M F gpu",
@@ -0,0 +1,8 @@
1
+
2
+
3
+ PROJECTS = [
4
+ "Deadpool",
5
+ "Harry Potter & the chamber of secrets",
6
+ "Captain Corelli's Mandolin",
7
+ "Gone with the Wind",
8
+ ]
tests/test_api_client.py CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  isort:skip_file
4
4
  """
5
-
5
+ import sys
6
6
  import unittest
7
-
7
+ import json
8
8
  try:
9
9
  from unittest import mock
10
10
  except ImportError:
@@ -12,6 +12,7 @@ except ImportError:
12
12
 
13
13
  from ciocore import api_client
14
14
 
15
+ from ciocore.api_client import request_extra_environment
15
16
 
16
17
  class ApiClientTest(unittest.TestCase):
17
18
  @staticmethod
@@ -45,3 +46,121 @@ class ApiClientTest(unittest.TestCase):
45
46
  fn = api_client.get_creds_path(api_key=True).replace("\\", "/")
46
47
  self.assertEqual(fn, "/users/joebloggs/.config/conductor/api_key_credentials")
47
48
 
49
+
50
+ class TestTruncateMiddle(unittest.TestCase):
51
+
52
+ def test_truncation_not_needed(self):
53
+ self.assertEqual(api_client.truncate_middle("short", 10), "short")
54
+
55
+ def test_truncation_with_even_max_length(self):
56
+ self.assertEqual(api_client.truncate_middle("1234567890ABCDEF", 8), "1234~DEF")
57
+
58
+ def test_truncation_with_odd_max_length(self):
59
+ self.assertEqual(api_client.truncate_middle("1234567890ABCDEF", 9), "1234~CDEF")
60
+
61
+ def test_empty_string(self):
62
+ self.assertEqual(api_client.truncate_middle("", 5), "")
63
+
64
+ def test_non_string_input(self):
65
+ with self.assertRaises(TypeError):
66
+ api_client.truncate_middle(12345, 5)
67
+
68
+ class TestRegisterClient(unittest.TestCase):
69
+ USER_AGENT_MAX_PATH_LENGTH = 10 # Example max length for testing
70
+
71
+ @classmethod
72
+ def setUpClass(cls):
73
+ cls.original_executable = sys.executable
74
+ sys.executable = '/usr/bin/python3' # Example path for testing
75
+
76
+ @classmethod
77
+ def tearDownClass(cls):
78
+ sys.executable = cls.original_executable
79
+
80
+ def test_register_client_with_version(self):
81
+ client_name = 'ApiClient'
82
+ client_version = '1.0'
83
+
84
+ with mock.patch('platform.python_version', return_value='3.8.2'), \
85
+ mock.patch('platform.system', return_value='Linux'), \
86
+ mock.patch('platform.release', return_value='5.4.0-42-generic'):
87
+ user_agent = api_client.ApiClient.register_client(client_name, client_version)
88
+
89
+ expected_user_agent = (
90
+ f"ApiClient/1.0 (python 3.8.2; Linux 5.4.0-42-generic; "
91
+ )
92
+ self.assertTrue(user_agent.startswith(expected_user_agent))
93
+
94
+ def test_register_client_without_version(self):
95
+ client_name = 'ApiClient'
96
+
97
+ with mock.patch('platform.python_version', return_value='3.8.2'), \
98
+ mock.patch('platform.system', return_value='Linux'), \
99
+ mock.patch('platform.release', return_value='5.4.0-42-generic'):
100
+ user_agent = api_client.ApiClient.register_client(client_name)
101
+
102
+
103
+ expected_user_agent = (
104
+ f"ApiClient/unknown (python 3.8.2; Linux 5.4.0-42-generic; "
105
+ )
106
+
107
+ self.assertTrue(user_agent.startswith(expected_user_agent))
108
+
109
+
110
+ class TestRequestExtraEnvironment(unittest.TestCase):
111
+
112
+ def setUp(self):
113
+ self.api_response_data = {
114
+ "data": [
115
+ {"account_id": "123", "env": ["VAR1=value1", "VAR2=value2"]},
116
+ {"account_id": "456", "env": ["VAR3=value3", "VAR4=value4"]}
117
+ ]
118
+ }
119
+ self.response_ok = mock.MagicMock(status_code=200, text=json.dumps(self.api_response_data))
120
+ self.response_error = mock.MagicMock(status_code=500, text=json.dumps({"error": "Internal Server Error"}))
121
+
122
+ @mock.patch("ciocore.api_client.ApiClient")
123
+ @mock.patch("ciocore.api_client.read_conductor_credentials")
124
+ @mock.patch("ciocore.api_client.account_id_from_jwt")
125
+ def test_request_extra_environment_success(self, mock_account_id_from_jwt, mock_read_conductor_credentials, mock_ApiClient):
126
+ # Set up mocks for successful execution
127
+ mock_read_conductor_credentials.return_value = "valid_token"
128
+ mock_account_id_from_jwt.return_value = "123"
129
+ mock_api_instance = mock_ApiClient.return_value
130
+ mock_api_instance.make_request.return_value = (self.response_ok.text, self.response_ok.status_code)
131
+
132
+ result = request_extra_environment()
133
+
134
+ self.assertEqual(result, ["VAR1=value1", "VAR2=value2"])
135
+ mock_ApiClient.assert_called_once()
136
+ mock_read_conductor_credentials.assert_called_once_with(True)
137
+ mock_account_id_from_jwt.assert_called_once_with("valid_token")
138
+
139
+ @mock.patch("ciocore.api_client.ApiClient")
140
+ def test_request_extra_environment_api_failure(self, mock_ApiClient):
141
+ # Set up mock for API failure
142
+ mock_api_instance = mock_ApiClient.return_value
143
+ mock_api_instance.make_request.return_value = (self.response_error.text, self.response_error.status_code)
144
+
145
+ # Assert exception raised when the API call fails
146
+ with self.assertRaises(Exception) as context:
147
+ request_extra_environment()
148
+
149
+ self.assertIn('Failed to get extra environment', str(context.exception))
150
+ mock_ApiClient.assert_called_once()
151
+
152
+ @mock.patch("ciocore.api_client.ApiClient")
153
+ @mock.patch("ciocore.api_client.read_conductor_credentials")
154
+ @mock.patch("ciocore.api_client.account_id_from_jwt")
155
+ def test_request_extra_environment_no_account_env(self, mock_account_id_from_jwt, mock_read_conductor_credentials, mock_ApiClient):
156
+ # Set up mocks to simulate valid token and account ID but no matching environment
157
+ mock_read_conductor_credentials.return_value = "valid_token"
158
+ mock_account_id_from_jwt.return_value = "invalid_id" # This won't match any 'account_id' in response
159
+ mock_api_instance = mock_ApiClient.return_value
160
+ mock_api_instance.make_request.return_value = (self.response_ok.text, self.response_ok.status_code)
161
+
162
+ with self.assertRaises(Exception) as context:
163
+ request_extra_environment()
164
+
165
+ self.assertEqual("Error: Could not get account environment!", str(context.exception))
166
+ mock_ApiClient.assert_called_once()
@@ -0,0 +1,104 @@
1
+ from ciocore.downloader.base_downloader import (
2
+ BaseDownloader,
3
+ DEFAULT_NUM_THREADS,
4
+ DEFAULT_PROGRESS_INTERVAL,
5
+ DEFAULT_MAX_ATTEMPTS,
6
+ DEFAULT_DELAY,
7
+ DEFAULT_JITTER,
8
+ DEFAULT_PAGE_SIZE,
9
+ )
10
+ import unittest
11
+ from unittest import mock
12
+
13
+ from ciocore import api_client
14
+
15
+ from unittest.mock import patch
16
+
17
+ from concurrent.futures import ThreadPoolExecutor
18
+
19
+
20
+ class TestBaseDownloaderInit(unittest.TestCase):
21
+ def test_default_values(self):
22
+ # Create an instance of the class
23
+ downloader = BaseDownloader()
24
+
25
+ # Assertions
26
+ self.assertIsNone(downloader.output_path)
27
+ self.assertFalse(downloader.force)
28
+ self.assertEqual(downloader.num_threads, DEFAULT_NUM_THREADS)
29
+ self.assertEqual(downloader.max_queue_size, DEFAULT_NUM_THREADS * 2)
30
+ self.assertEqual(
31
+ downloader.progress_interval, DEFAULT_PROGRESS_INTERVAL / 1000.0
32
+ )
33
+ self.assertEqual(downloader.page_size, DEFAULT_PAGE_SIZE)
34
+ self.assertIsInstance(downloader.client, api_client.ApiClient)
35
+ self.assertEqual(downloader.max_attempts, DEFAULT_MAX_ATTEMPTS)
36
+ self.assertEqual(downloader.delay, DEFAULT_DELAY)
37
+ self.assertEqual(downloader.jitter, DEFAULT_JITTER)
38
+ self.assertIsNone(downloader.regex)
39
+
40
+
41
+ def test_custom_values(self):
42
+ output_path = "/path/to/destination"
43
+ num_threads = 4
44
+ progress_interval = 500
45
+ page_size = 10
46
+ force = True
47
+ regex = r"\d+"
48
+ max_attempts = 3
49
+ delay = 2
50
+ jitter = 0.5
51
+
52
+ downloader = BaseDownloader(
53
+ output_path=output_path,
54
+ num_threads=num_threads,
55
+ progress_interval=progress_interval,
56
+ page_size=page_size,
57
+ force=force,
58
+ regex=regex,
59
+ max_attempts=max_attempts,
60
+ delay=delay,
61
+ jitter=jitter,
62
+ )
63
+
64
+ # Assertions
65
+ self.assertEqual(downloader.output_path, output_path)
66
+ self.assertTrue(downloader.force)
67
+ self.assertEqual(downloader.num_threads, num_threads)
68
+ self.assertEqual(downloader.max_queue_size, num_threads * 2)
69
+ self.assertAlmostEqual(downloader.progress_interval, progress_interval / 1000.0)
70
+ self.assertEqual(downloader.page_size, page_size)
71
+ self.assertIsInstance(downloader.client, api_client.ApiClient)
72
+ self.assertEqual(downloader.max_attempts, max_attempts)
73
+ self.assertEqual(downloader.delay, delay)
74
+ self.assertEqual(downloader.jitter, jitter)
75
+ self.assertIsNotNone(downloader.regex)
76
+
77
+
78
+ class TestBaseDownloaderRun(unittest.TestCase):
79
+ def setUp(self):
80
+ self.downloader = BaseDownloader()
81
+
82
+ def tearDown(self):
83
+ pass
84
+
85
+ def test_run_method(self):
86
+ with patch(
87
+ "ciocore.downloader.base_downloader.ThreadPoolExecutor"
88
+ ) as mock_executor:
89
+ my_mock_executor = mock.MagicMock(spec=ThreadPoolExecutor)
90
+
91
+ mock_executor.return_value.__enter__.return_value = my_mock_executor
92
+
93
+ tasks = [{"id": 1, "name": "task1"}, {"id": 2, "name": "task2"}]
94
+ next_locator = False
95
+ mock_get_some_tasks = mock.MagicMock(return_value=(tasks, next_locator))
96
+
97
+ self.downloader.get_some_tasks = mock_get_some_tasks
98
+ self.downloader.download_tasks = mock.MagicMock()
99
+ self.downloader.event_queue = mock.MagicMock()
100
+
101
+ self.downloader.run()
102
+
103
+ mock_get_some_tasks.assert_called_with(None)
104
+ self.downloader.download_tasks.assert_called_with(tasks, my_mock_executor)