|
15 | 15 | from airflow.operators.bash import BashOperator
|
16 | 16 | from airflow.exceptions import AirflowException
|
17 | 17 | from airflow.providers.http.hooks.http import HttpHook
|
| 18 | +from airflow.decorators import task |
18 | 19 |
|
19 | 20 | from hubmap_operators.common_operators import (
|
20 | 21 | LogInfoOperator,
|
|
38 | 39 | )
|
39 | 40 |
|
40 | 41 | from misc.tools.split_and_create import reorganize
|
| 42 | +from misc.tools.set_standard_protections import process_one_uuid |
| 43 | +from misc.tools.survey import EntityFactory |
41 | 44 |
|
42 | 45 |
|
43 | 46 | # Following are defaults which can be overridden later on
|
@@ -299,6 +302,21 @@ def my_callable(**kwargs):
|
299 | 302 | def xcom_consistency_puller(**kwargs):
|
300 | 303 | return kwargs["ti"].xcom_pull(task_ids="split_stage_2", key="child_uuid_list")
|
301 | 304 |
|
| 305 | + |
| 306 | + @task(task_id="permission_resetting") |
| 307 | + def permission_resetting(**kwargs): |
| 308 | + return_error = [] |
| 309 | + entity_host = HttpHook.get_connection("entity_api_connection").host |
| 310 | + entity_factory = EntityFactory(get_auth_tok(**kwargs), |
| 311 | + instance=find_matching_endpoint(entity_host)) |
| 312 | + for uuid in kwargs["ti"].xcom_pull(task_ids="split_stage_2", key="child_uuid_list"): |
| 313 | + return_error.append(process_one_uuid(uuid, entity_factory)) |
| 314 | + if False in return_error: |
| 315 | + return 1 |
| 316 | + return 0 |
| 317 | + |
| 318 | + t_reset_permissions = permission_resetting() |
| 319 | + |
302 | 320 | t_md_consistency_tests = PythonOperator(
|
303 | 321 | task_id="md_consistency_tests",
|
304 | 322 | python_callable=utils.pythonop_md_consistency_tests,
|
@@ -414,6 +432,7 @@ def _get_upload_uuid(**kwargs):
|
414 | 432 | >> t_maybe_keep_2
|
415 | 433 | >> t_run_md_extract
|
416 | 434 | >> t_md_consistency_tests
|
| 435 | + >> t_reset_permissions |
417 | 436 | >> t_send_status
|
418 | 437 | >> t_join
|
419 | 438 | >> t_preserve_info
|
|
0 commit comments