aind-data-transfer-service 1.12.1__tar.gz → 1.13.0__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.

Potentially problematic release.


This version of aind-data-transfer-service might be problematic. Click here for more details.

Files changed (107) hide show
  1. aind_data_transfer_service-1.13.0/CODE_OF_CONDUCT.md +133 -0
  2. {aind_data_transfer_service-1.12.1/src/aind_data_transfer_service.egg-info → aind_data_transfer_service-1.13.0}/PKG-INFO +1 -1
  3. aind_data_transfer_service-1.13.0/docs/examples/basic_upload.py +76 -0
  4. aind_data_transfer_service-1.13.0/docs/examples/behavior_videos_compression.py +123 -0
  5. aind_data_transfer_service-1.13.0/docs/examples/custom_codeocean_pipeline_settings.py +107 -0
  6. aind_data_transfer_service-1.13.0/docs/examples/custom_metadata_mapper_settings.py +113 -0
  7. aind_data_transfer_service-1.13.0/docs/examples/example1.csv +4 -0
  8. aind_data_transfer_service-1.13.0/docs/examples/hcr_example.py +81 -0
  9. aind_data_transfer_service-1.13.0/docs/examples/skip_s3_check.py +78 -0
  10. aind_data_transfer_service-1.13.0/docs/examples/upload_with_custom_slurm_settings.py +86 -0
  11. aind_data_transfer_service-1.13.0/docs/examples/upload_with_notification.py +79 -0
  12. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/Contributing.rst +1 -0
  13. aind_data_transfer_service-1.12.1/docs/source/UserGuide.rst → aind_data_transfer_service-1.13.0/docs/source/UserGuideV1.rst +27 -29
  14. aind_data_transfer_service-1.13.0/docs/source/UserGuideV2.rst +200 -0
  15. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/index.rst +2 -1
  16. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/__init__.py +1 -1
  17. aind_data_transfer_service-1.13.0/src/aind_data_transfer_service/configs/csv_handler.py +118 -0
  18. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/configs/job_upload_template.py +7 -10
  19. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/server.py +14 -3
  20. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/templates/index.html +26 -14
  21. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0/src/aind_data_transfer_service.egg-info}/PKG-INFO +1 -1
  22. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service.egg-info/SOURCES.txt +14 -1
  23. aind_data_transfer_service-1.13.0/tests/resources/job_upload_template.xlsx +0 -0
  24. aind_data_transfer_service-1.13.0/tests/resources/legacy_sample.csv +4 -0
  25. aind_data_transfer_service-1.13.0/tests/resources/legacy_sample2.csv +2 -0
  26. aind_data_transfer_service-1.13.0/tests/resources/new_sample.csv +4 -0
  27. aind_data_transfer_service-1.13.0/tests/resources/sample_empty_rows_2.csv +7 -0
  28. aind_data_transfer_service-1.13.0/tests/resources/sample_malformed_2.csv +2 -0
  29. aind_data_transfer_service-1.13.0/tests/test_csv_handler.py +235 -0
  30. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/test_server.py +57 -28
  31. aind_data_transfer_service-1.12.1/docs/examples/example1.csv +0 -4
  32. aind_data_transfer_service-1.12.1/src/aind_data_transfer_service/configs/csv_handler.py +0 -59
  33. aind_data_transfer_service-1.12.1/tests/resources/job_upload_template.xlsx +0 -0
  34. aind_data_transfer_service-1.12.1/tests/resources/new_sample.csv +0 -4
  35. aind_data_transfer_service-1.12.1/tests/resources/sample_malformed_2.csv +0 -2
  36. aind_data_transfer_service-1.12.1/tests/test_csv_handler.py +0 -110
  37. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.flake8 +0 -0
  38. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  39. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  40. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.github/ISSUE_TEMPLATE/user-story.md +0 -0
  41. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.github/workflows/add_issue_to_project_board.yml +0 -0
  42. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.github/workflows/publish_dev.yml +0 -0
  43. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.github/workflows/publish_main.yml +0 -0
  44. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.github/workflows/run_dev_tests.yml +0 -0
  45. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.github/workflows/run_main_tests.yml +0 -0
  46. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.gitignore +0 -0
  47. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/.readthedocs.yaml +0 -0
  48. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/Dockerfile +0 -0
  49. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/LICENSE +0 -0
  50. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/README.md +0 -0
  51. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/Makefile +0 -0
  52. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/diagrams/system_container.png +0 -0
  53. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/diagrams/system_container.puml +0 -0
  54. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/diagrams/system_context.png +0 -0
  55. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/diagrams/system_context.puml +0 -0
  56. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/make.bat +0 -0
  57. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/_static/dark-logo.svg +0 -0
  58. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/_static/favicon.ico +0 -0
  59. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/_static/light-logo.svg +0 -0
  60. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/aind_data_transfer_service.configs.rst +0 -0
  61. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/aind_data_transfer_service.hpc.rst +0 -0
  62. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/aind_data_transfer_service.models.rst +0 -0
  63. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/aind_data_transfer_service.rst +0 -0
  64. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/conf.py +0 -0
  65. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/docs/source/modules.rst +0 -0
  66. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/pyproject.toml +0 -0
  67. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/setup.cfg +0 -0
  68. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/setup.py +0 -0
  69. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/configs/__init__.py +0 -0
  70. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/configs/job_configs.py +0 -0
  71. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/hpc/__init__.py +0 -0
  72. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/hpc/client.py +0 -0
  73. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/hpc/models.py +0 -0
  74. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/log_handler.py +0 -0
  75. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/models/__init__.py +0 -0
  76. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/models/core.py +0 -0
  77. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/models/internal.py +0 -0
  78. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/templates/job_params.html +0 -0
  79. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/templates/job_status.html +0 -0
  80. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/templates/job_tasks_table.html +0 -0
  81. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service/templates/task_logs.html +0 -0
  82. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service.egg-info/dependency_links.txt +0 -0
  83. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service.egg-info/requires.txt +0 -0
  84. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/src/aind_data_transfer_service.egg-info/top_level.txt +0 -0
  85. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/__init__.py +0 -0
  86. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/airflow_dag_run_response.json +0 -0
  87. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/airflow_dag_runs_response.json +0 -0
  88. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/airflow_task_instances_response.json +0 -0
  89. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/describe_parameters_response.json +0 -0
  90. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/get_parameter_response.json +0 -0
  91. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/sample.csv +0 -0
  92. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/sample.xlsx +0 -0
  93. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/sample_alt_modality_case.csv +0 -0
  94. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/sample_empty_rows.csv +0 -0
  95. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/sample_empty_rows.xlsx +0 -0
  96. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/sample_invalid_ext.txt +0 -0
  97. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/sample_malformed.csv +0 -0
  98. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/resources/sample_malformed.xlsx +0 -0
  99. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/test_configs.py +0 -0
  100. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/test_core.py +0 -0
  101. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/test_hpc_client.py +0 -0
  102. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/test_hpc_models.py +0 -0
  103. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/test_internal.py +0 -0
  104. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/test_job_upload_template.py +0 -0
  105. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/test_log_handler.py +0 -0
  106. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/test_server/Dockerfile +0 -0
  107. {aind_data_transfer_service-1.12.1 → aind_data_transfer_service-1.13.0}/tests/test_server/db.json +0 -0
@@ -0,0 +1,133 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, religion, or sexual identity
11
+ and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the
27
+ overall community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or
32
+ advances of any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official email address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ ScientificComputing@AllenInstitute.onmicrosoft.com.
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series
87
+ of actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or
94
+ permanent ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within
114
+ the community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.0, available at
120
+ [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
127
+ at [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aind-data-transfer-service
3
- Version: 1.12.1
3
+ Version: 1.13.0
4
4
  Summary: Service that handles requests to upload data to the cloud
5
5
  Author: Allen Institute for Neural Dynamics
6
6
  License: MIT
@@ -0,0 +1,76 @@
1
+ """
2
+ This example demonstrates how to set a modality and metadata directory. It
3
+ assumes that the job_type has been defined.
4
+ """
5
+
6
+ from datetime import datetime
7
+
8
+ import requests
9
+ from aind_data_schema_models.modalities import Modality
10
+ from aind_data_schema_models.platforms import Platform
11
+
12
+ from aind_data_transfer_service.models.core import (
13
+ SubmitJobRequestV2,
14
+ Task,
15
+ UploadJobConfigsV2,
16
+ )
17
+
18
+ # The job_type contains the default settings for compression and Code Ocean
19
+ # pipelines.
20
+ job_type = "ecephys"
21
+
22
+ acq_datetime = datetime(2023, 4, 3, 18, 17, 7)
23
+
24
+ ecephys_task = Task(
25
+ job_settings={
26
+ "input_source": (
27
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/"
28
+ "ecephys/655019_2023-04-03_18-17-07"
29
+ )
30
+ }
31
+ )
32
+
33
+ modality_transformation_settings = {"ecephys": ecephys_task}
34
+
35
+ gather_preliminary_metadata = Task(
36
+ job_settings={
37
+ "metadata_dir": (
38
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/"
39
+ "ecephys/655019_2023-04-03_18-17-07"
40
+ )
41
+ }
42
+ )
43
+
44
+
45
+ upload_job_configs_v2 = UploadJobConfigsV2(
46
+ job_type=job_type,
47
+ project_name="Ephys Platform",
48
+ platform=Platform.ECEPHYS,
49
+ modalities=[Modality.ECEPHYS],
50
+ subject_id="655019",
51
+ acq_datetime=acq_datetime,
52
+ tasks={
53
+ "modality_transformation_settings": modality_transformation_settings,
54
+ "gather_preliminary_metadata": gather_preliminary_metadata,
55
+ },
56
+ )
57
+
58
+ submit_request_v2 = SubmitJobRequestV2(
59
+ upload_jobs=[upload_job_configs_v2],
60
+ )
61
+
62
+ post_request_content = submit_request_v2.model_dump(
63
+ mode="json", exclude_none=True
64
+ )
65
+
66
+ # Please use the production endpoint for submitting jobs and the dev endpoint
67
+ # for running tests.
68
+ # endpoint = "http://aind-data-transfer-service"
69
+ endpoint = "http://aind-data-transfer-service-dev" # For testing
70
+
71
+ submit_job_response = requests.post(
72
+ url=f"{endpoint}/api/v2/submit_jobs",
73
+ json=post_request_content,
74
+ )
75
+ print(submit_job_response.status_code)
76
+ print(submit_job_response.json())
@@ -0,0 +1,123 @@
1
+ """
2
+ This example demonstrates how to perform behavior video compression when a
3
+ predefined job_type is not available. However, it might be better to request a
4
+ job_type to be stored.
5
+ """
6
+
7
+ from datetime import datetime
8
+
9
+ import requests
10
+ from aind_data_schema_models.modalities import Modality
11
+ from aind_data_schema_models.platforms import Platform
12
+
13
+ from aind_data_transfer_service.models.core import (
14
+ SubmitJobRequestV2,
15
+ Task,
16
+ UploadJobConfigsV2,
17
+ )
18
+
19
+ # As default, behavior videos are not compressed during upload.
20
+ # This example demonstrates how to override the default behavior.
21
+ job_type = "default"
22
+
23
+ acq_datetime = datetime(2024, 5, 9, 12, 31, 22)
24
+
25
+ behavior_task = Task(
26
+ job_settings={
27
+ "input_source": (
28
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/"
29
+ "behavior_711256_2024-05-09_12-31-22/behavior"
30
+ )
31
+ }
32
+ )
33
+
34
+ # Using a predefined job_type would simplify this model greatly.
35
+ # Alternatively, this model can be validated against the JobSettings
36
+ # pydantic class in the aind-behavior-video-transformation package.
37
+ behavior_video_job_settings = {
38
+ "input_source": (
39
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/"
40
+ "behavior_711256_2024-05-09_12-31-22/behavior-videos"
41
+ ),
42
+ "output_directory": "%OUTPUT_LOCATION", # This will be replaced by svc
43
+ "compression_requested": {"compression_enum": "gamma fix colorspace"},
44
+ }
45
+ behavior_videos_task = {
46
+ "skip_task": False,
47
+ "image": "ghcr.io/allenneuraldynamics/aind-behavior-video-transformation",
48
+ "image_version": "0.1.7",
49
+ "image_resources": {
50
+ "memory_per_cpu": {"set": True, "number": 250},
51
+ "minimum_cpus_per_node": 32,
52
+ "partition": "aind",
53
+ "qos": "dev",
54
+ "standard_error": (
55
+ "/allen/aind/scratch/svc_aind_airflow/dev/logs/%x_%j_error.out"
56
+ ),
57
+ "tasks": 1,
58
+ "time_limit": {"set": True, "number": 720},
59
+ "standard_output": (
60
+ "/allen/aind/scratch/svc_aind_airflow/dev/logs/%x_%j.out"
61
+ ),
62
+ "environment": [
63
+ "PATH=/bin:/usr/bin/:/usr/local/bin/",
64
+ "LD_LIBRARY_PATH=/lib/:/lib64/:/usr/local/lib",
65
+ ],
66
+ "current_working_directory": ".",
67
+ },
68
+ "job_settings": behavior_video_job_settings,
69
+ "command_script": (
70
+ "#!/bin/bash \nsingularity exec --cleanenv "
71
+ "docker://%IMAGE:%IMAGE_VERSION python -m "
72
+ "aind_behavior_video_transformation.etl "
73
+ "--job-settings ' %JOB_SETTINGS '"
74
+ ),
75
+ }
76
+
77
+ modality_transformation_settings = {
78
+ "behavior": behavior_task,
79
+ "behavior-videos": behavior_videos_task,
80
+ }
81
+
82
+ gather_preliminary_metadata = Task(
83
+ job_settings={
84
+ "metadata_dir": (
85
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/"
86
+ "behavior_711256_2024-05-09_12-31-22/metadata-dir"
87
+ )
88
+ }
89
+ )
90
+
91
+
92
+ upload_job_configs_v2 = UploadJobConfigsV2(
93
+ job_type=job_type,
94
+ project_name="Behavior Platform",
95
+ platform=Platform.BEHAVIOR,
96
+ modalities=[Modality.BEHAVIOR, Modality.BEHAVIOR_VIDEOS],
97
+ subject_id="711256",
98
+ acq_datetime=acq_datetime,
99
+ tasks={
100
+ "modality_transformation_settings": modality_transformation_settings,
101
+ "gather_preliminary_metadata": gather_preliminary_metadata,
102
+ },
103
+ )
104
+
105
+ submit_request_v2 = SubmitJobRequestV2(
106
+ upload_jobs=[upload_job_configs_v2],
107
+ )
108
+
109
+ post_request_content = submit_request_v2.model_dump(
110
+ mode="json", exclude_none=True
111
+ )
112
+
113
+ # Please use the production endpoint for submitting jobs and the dev endpoint
114
+ # for running tests.
115
+ # endpoint = "http://aind-data-transfer-service"
116
+ endpoint = "http://aind-data-transfer-service-dev" # For testing
117
+
118
+ submit_job_response = requests.post(
119
+ url=f"{endpoint}/api/v2/submit_jobs",
120
+ json=post_request_content,
121
+ )
122
+ print(submit_job_response.status_code)
123
+ print(submit_job_response.json())
@@ -0,0 +1,107 @@
1
+ """
2
+ This example demonstrates how to set custom configs for the code ocean
3
+ pipeline monitor capsule. It is recommended to specify a job_type to set the
4
+ code ocean settings.
5
+ """
6
+
7
+ from datetime import datetime
8
+
9
+ import requests
10
+ from aind_data_schema_models.modalities import Modality
11
+ from aind_data_schema_models.platforms import Platform
12
+
13
+ from aind_data_transfer_service.models.core import (
14
+ SubmitJobRequestV2,
15
+ Task,
16
+ UploadJobConfigsV2,
17
+ )
18
+
19
+ # The job_type contains the default settings for compression and Code Ocean
20
+ # pipelines.
21
+ job_type = "default"
22
+
23
+ acq_datetime = datetime(2023, 4, 3, 18, 17, 7)
24
+
25
+ # As default, compression won't be run.
26
+ ecephys_task = Task(
27
+ job_settings={
28
+ "input_source": (
29
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/"
30
+ "ecephys/655019_2023-04-03_18-17-07"
31
+ )
32
+ }
33
+ )
34
+
35
+ modality_transformation_settings = {"ecephys": ecephys_task}
36
+
37
+ gather_preliminary_metadata = Task(
38
+ job_settings={
39
+ "metadata_dir": (
40
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/"
41
+ "ecephys/655019_2023-04-03_18-17-07"
42
+ )
43
+ }
44
+ )
45
+
46
+ # For extra validation on the pipeline_monitor_settings field, you can import
47
+ # the pydantic model by pip installing aind-codeocean-pipeline-monitor
48
+ # and importing aind_codeocean_pipeline_monitor.models.PipelineMonitorSettings.
49
+ # We provide a default pipeline monitor capsule id, but you can
50
+ # override it by uncommenting the pipeline_monitor_capsule_id key.
51
+ ecephys_codeocean_pipeline_settings = Task(
52
+ skip_task=False,
53
+ job_settings={
54
+ # "pipeline_monitor_capsule_id": ...,
55
+ "pipeline_monitor_settings": {
56
+ "run_params": {
57
+ "capsule_id": "87cbe6ce-9b38-4266-8d4a-62f0e23ba2d6",
58
+ },
59
+ "capture_settings": {
60
+ "permissions": {"everyone": "viewer"},
61
+ "tags": ["derived", "test"],
62
+ "custom_metadata": {
63
+ "data level": "derived",
64
+ },
65
+ "process_name_suffix": "test",
66
+ },
67
+ },
68
+ },
69
+ )
70
+
71
+ # You can specify one pipeline per modality:
72
+ codeocean_pipeline_settings = {"ecephys": ecephys_codeocean_pipeline_settings}
73
+
74
+
75
+ upload_job_configs_v2 = UploadJobConfigsV2(
76
+ job_type=job_type,
77
+ project_name="Ephys Platform",
78
+ platform=Platform.ECEPHYS,
79
+ modalities=[Modality.ECEPHYS],
80
+ subject_id="655019",
81
+ acq_datetime=acq_datetime,
82
+ tasks={
83
+ "modality_transformation_settings": modality_transformation_settings,
84
+ "gather_preliminary_metadata": gather_preliminary_metadata,
85
+ "codeocean_pipeline_settings": codeocean_pipeline_settings,
86
+ },
87
+ )
88
+
89
+ submit_request_v2 = SubmitJobRequestV2(
90
+ upload_jobs=[upload_job_configs_v2],
91
+ )
92
+
93
+ post_request_content = submit_request_v2.model_dump(
94
+ mode="json", exclude_none=True
95
+ )
96
+
97
+ # Please use the production endpoint for submitting jobs and the dev endpoint
98
+ # for running tests.
99
+ # endpoint = "http://aind-data-transfer-service"
100
+ endpoint = "http://aind-data-transfer-service-dev" # For testing
101
+
102
+ submit_job_response = requests.post(
103
+ url=f"{endpoint}/api/v2/submit_jobs",
104
+ json=post_request_content,
105
+ )
106
+ print(submit_job_response.status_code)
107
+ print(submit_job_response.json())
@@ -0,0 +1,113 @@
1
+ """
2
+ This example demonstrates how to pass in custom job_settings into the metadata
3
+ mapper package. It assumes a user has pip installed the aind-metadata-mapper
4
+ package. If there are dependency conflicts it may also be possible to use raw
5
+ dictionaries.
6
+ """
7
+
8
+ from datetime import datetime
9
+
10
+ import requests
11
+ from aind_data_schema_models.modalities import Modality
12
+ from aind_data_schema_models.platforms import Platform
13
+ from aind_metadata_mapper.bergamo.models import (
14
+ JobSettings as BergamoSessionSettings,
15
+ )
16
+ from aind_metadata_mapper.models import (
17
+ JobSettings as GatherMetadataJobSettings,
18
+ )
19
+ from aind_metadata_mapper.models import SessionSettings
20
+
21
+ from aind_data_transfer_service.models.core import (
22
+ SubmitJobRequestV2,
23
+ Task,
24
+ UploadJobConfigsV2,
25
+ )
26
+
27
+ # This job_type contains the default settings for compression and Code Ocean
28
+ # pipelines. We recommend creating a custom one for your experiments. Reach
29
+ # out to Scientific Computing for more information.
30
+ job_type = "default"
31
+
32
+ # acq_datetime = datetime(2025, 4, 25, 16, 41, 23)
33
+ acq_datetime = datetime(2020, 4, 25, 16, 41, 0)
34
+
35
+ # Compression settings. As job_type default, no compression will be performed.
36
+ pophys_task = Task(
37
+ job_settings={
38
+ "input_source": (
39
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/bci/"
40
+ "042525/042525/pophys"
41
+ )
42
+ }
43
+ )
44
+
45
+ modality_transformation_settings = {"pophys": pophys_task}
46
+
47
+ # 1. Define the JobSettings for the GatherMetadataJob in aind-metadata-mapper
48
+ bergamo_session_settings = BergamoSessionSettings(
49
+ input_source=(
50
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/bci/"
51
+ "042525/042525/pophys"
52
+ ),
53
+ experimenter_full_name=["John Apple"],
54
+ subject_id="784746",
55
+ imaging_laser_wavelength=920,
56
+ fov_imaging_depth=100,
57
+ fov_targeted_structure="Primary Motor Cortex",
58
+ notes="test upload",
59
+ )
60
+
61
+ # 2. Define SessionSettings object with defined job settings
62
+ session_settings = SessionSettings(job_settings=bergamo_session_settings)
63
+
64
+ # 3. Define GatherMetadataJobSettings with session_settings.
65
+ # %OUTPUT_LOCATION is a special string that will be replaced by the service
66
+ # with the correct staging location.
67
+ metadata_job_settings = GatherMetadataJobSettings(
68
+ directory_to_write_to="%OUTPUT_LOCATION",
69
+ session_settings=session_settings,
70
+ metadata_dir=(
71
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/bci/042525/042525"
72
+ ),
73
+ )
74
+
75
+ gather_preliminary_metadata = Task(
76
+ job_settings=metadata_job_settings.model_dump(
77
+ mode="json", exclude_none=True
78
+ )
79
+ )
80
+
81
+
82
+ upload_job_configs_v2 = UploadJobConfigsV2(
83
+ job_type=job_type,
84
+ project_name="Brain Computer Interface",
85
+ platform=Platform.SINGLE_PLANE_OPHYS,
86
+ modalities=[Modality.POPHYS],
87
+ subject_id="784746",
88
+ acq_datetime=acq_datetime,
89
+ tasks={
90
+ "modality_transformation_settings": modality_transformation_settings,
91
+ "gather_preliminary_metadata": gather_preliminary_metadata,
92
+ },
93
+ )
94
+
95
+ submit_request_v2 = SubmitJobRequestV2(
96
+ upload_jobs=[upload_job_configs_v2],
97
+ )
98
+
99
+ post_request_content = submit_request_v2.model_dump(
100
+ mode="json", exclude_none=True
101
+ )
102
+
103
+ # Please use the production endpoint for submitting jobs and the dev endpoint
104
+ # for running tests.
105
+ # endpoint = "http://aind-data-transfer-service"
106
+ endpoint = "http://aind-data-transfer-service-dev" # For testing
107
+
108
+ submit_job_response = requests.post(
109
+ url=f"{endpoint}/api/v2/submit_jobs",
110
+ json=post_request_content,
111
+ )
112
+ print(submit_job_response.status_code)
113
+ print(submit_job_response.json())
@@ -0,0 +1,4 @@
1
+ project_name, modality0.capsule_id, modality0, modality0.input_source, modality1, modality1.input_source, s3_bucket, subject_id, platform, acq_datetime, job_type
2
+ Ephys Platform, , ecephys, dir/data_set_1, ,, default, 123454, ecephys, 2020-10-10 14:10:10, ecephys
3
+ Behavior Platform, 1f999652-00a0-4c4b-99b5-64c2985ad070, behavior-videos, dir/data_set_2, MRI, dir/data_set_3, open, 123456, behavior, 10/13/2020 1:10:10 PM,
4
+ Behavior Platform, , behavior-videos, dir/data_set_2, behavior, dir/data_set_3, private, 123456, behavior, 10/13/2020 1:10:10 PM,
@@ -0,0 +1,81 @@
1
+ """This example demonstrates how to submit an HCR job."""
2
+
3
+ from datetime import datetime
4
+
5
+ import requests
6
+ from aind_data_schema_models.modalities import Modality
7
+ from aind_data_schema_models.platforms import Platform
8
+
9
+ from aind_data_transfer_service.models.core import (
10
+ SubmitJobRequestV2,
11
+ Task,
12
+ UploadJobConfigsV2,
13
+ )
14
+
15
+ job_type = "HCR"
16
+
17
+ acq_datetime = datetime(2025, 3, 10, 12, 0, 9)
18
+
19
+ num_of_partitions: int = 4
20
+
21
+ # Add custom job_settings for the hcr image python command.
22
+ spim_task = Task(
23
+ image_resources={"array": f"0-{num_of_partitions - 1}"},
24
+ job_settings={
25
+ "input_source": (
26
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/"
27
+ "HCR_772646_2025-03-10_12-00-00"
28
+ ),
29
+ "num_of_partitions": num_of_partitions,
30
+ },
31
+ )
32
+
33
+ modality_settings = {
34
+ Modality.SPIM.abbreviation: spim_task,
35
+ }
36
+
37
+ gather_preliminary_metadata = Task(
38
+ job_settings={
39
+ "metadata_dir": (
40
+ "/allen/aind/scratch/svc_aind_upload/test_data_sets/"
41
+ "HCR_772646_2025-03-10_12-00-00"
42
+ )
43
+ }
44
+ )
45
+
46
+ # The job_type loads defaults settings from AWS Parameter Store
47
+ upload_job_configs_v2 = UploadJobConfigsV2(
48
+ job_type=job_type,
49
+ s3_bucket="open",
50
+ project_name="MSMA Platform",
51
+ platform=Platform.HCR,
52
+ modalities=[Modality.SPIM],
53
+ subject_id="772646",
54
+ acq_datetime=acq_datetime,
55
+ tasks={
56
+ "modality_transformation_settings": modality_settings,
57
+ "gather_preliminary_metadata": gather_preliminary_metadata,
58
+ },
59
+ )
60
+
61
+ upload_jobs = [upload_job_configs_v2]
62
+
63
+ submit_request = SubmitJobRequestV2(
64
+ upload_jobs=upload_jobs,
65
+ )
66
+
67
+ post_request_content = submit_request.model_dump(
68
+ mode="json", exclude_none=True
69
+ )
70
+
71
+ # Please use the production endpoint for submitting jobs and the dev endpoint
72
+ # for running tests.
73
+ # endpoint = "http://aind-data-transfer-service"
74
+ endpoint = "http://aind-data-transfer-service-dev" # For testing
75
+
76
+ submit_job_response = requests.post(
77
+ url=f"{endpoint}/api/v2/submit_jobs",
78
+ json=post_request_content,
79
+ )
80
+ print(submit_job_response.status_code)
81
+ print(submit_job_response.json())