Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle request cancellation in Airlock processor #2584

Conversation

yuvalyaron
Copy link
Collaborator

@yuvalyaron yuvalyaron commented Sep 11, 2022

Resolves #1968

What is being addressed

  • Added handling for Airlock request cancellations by deleting the container of the request.
  • Refactored StatusChangedQueueTrigger

How is this addressed

  • Made StatusChangedQueueTrigger send a toDeleteEvent when a request is cancelled.
  • Made the API send previous_status in addition to new_status in "status changed" messages
  • Added support for container deletion in ToDeleteTrigger Azure Function
  • Refactored StatusChangedQueueTrigger by extracting code from method: get_source_dest_for_copy into 2 new methods: get_storage_account for getting the source and get_storage_account_destination_for_copy for getting the target

@github-actions
Copy link

github-actions bot commented Sep 11, 2022

Unit Test Results

524 tests  +521   522 ✔️ +520   17s ⏱️ - 2h 13m 52s
    2 suites +    1       2 💤 +    2 
    2 files   +    1       0  -     1 

Results for commit a44e3bd. ± Comparison against base commit 7fe7a89.

This pull request removes 3 and adds 524 tests. Note that renamed tests count towards both.
test_airlock ‑ test_airlock_import_flow
test_workspace_services ‑ test_create_guacamole_service_into_aad_workspace
test_workspace_services ‑ test_create_guacamole_service_into_base_workspace
tests.shared_code.test_blob_operations.TestBlobOperations ‑ test_copy_data_adds_copied_from_metadata
tests.shared_code.test_blob_operations.TestBlobOperations ‑ test_copy_data_fails_if_no_blobs_to_copy
tests.shared_code.test_blob_operations.TestBlobOperations ‑ test_copy_data_fails_if_too_many_blobs_to_copy
tests.shared_code.test_blob_operations.TestBlobOperations ‑ test_get_blob_info_from_topic_and_subject
tests.shared_code.test_blob_operations.TestBlobOperations ‑ test_get_blob_info_from_url
tests.shared_code.test_blob_operations.TestBlobOperations ‑ test_get_blob_url_should_return_blob_url
tests.shared_code.test_blob_operations.TestBlobOperations ‑ test_get_blob_url_without_blob_name_should_return_container_url
tests.test_status_change_queue_trigger.TestDataCopyProperties ‑ test_only_specific_status_are_triggering_copy
tests.test_status_change_queue_trigger.TestDataCopyProperties ‑ test_wrong_status_raises_when_getting_storage_account_properties
tests.test_status_change_queue_trigger.TestDataCopyProperties ‑ test_wrong_type_raises_when_getting_storage_account_properties
…

♻️ This comment has been updated with latest results.

@yuvalyaron yuvalyaron marked this pull request as ready for review September 12, 2022 13:35
@eladiw
Copy link
Contributor

eladiw commented Sep 12, 2022

A. IMO toDeleteTrigger should be called ContainerDeletionTrigger
B. toDeleteEvent can be called containerDeletionEvent

Copy link
Contributor

@eladiw eladiw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job. I had one major comment about the naming but the overall refactoring looks good!

CHANGELOG.md Outdated Show resolved Hide resolved
airlock_processor/BlobCreatedTrigger/__init__.py Outdated Show resolved Hide resolved
airlock_processor/StatusChangedQueueTrigger/__init__.py Outdated Show resolved Hide resolved
airlock_processor/StatusChangedQueueTrigger/__init__.py Outdated Show resolved Hide resolved
airlock_processor/StatusChangedQueueTrigger/__init__.py Outdated Show resolved Hide resolved
airlock_processor/StatusChangedQueueTrigger/__init__.py Outdated Show resolved Hide resolved
yuvalyaron and others added 2 commits September 13, 2022 10:42
Co-authored-by: Elad Iwanir <13205761+eladiw@users.noreply.github.com>
Co-authored-by: Elad Iwanir <13205761+eladiw@users.noreply.github.com>
@tanya-borisova
Copy link
Contributor

tanya-borisova commented Sep 13, 2022

I can clarify why the ToDeleteTrigger was named this way: prior to its introduction, all the other triggers were named after the episode that caused the trigger to set off. With ToDelete, this "episode" is "a new item to delete has appeared", and this is why it's called this way (for brevity). I agree it's a little clumsy though!

I support renaming it but would say that adding a "container" into its name would make the name inaccurate, as currently the event contains the URL of the blob to delete and not the whole container (which I don't think was changed in this PR). Also, the form "deletion" doesn't sound consistent with the rest of the trigger names, e.g. "BlobCreatedTrigger" still has an adjective in the name.

@yuvalyaron
Copy link
Collaborator Author

while not consistent, I don't think the term 'deletion' sounds off, I think DataDeletionTrigger and BlobDeletionTrigger are good options, as it's clear what their purpose is.
Something like BlobSentForDeletionTrigger which I think is consistent, might confuse in my opinion..
what do you think? do you have any other alternatives or favorites?
@tanya-borisova @eladiw

@tanya-borisova
Copy link
Contributor

I like DataDeletionTrigger the most out of those proposed!

@yuvalyaron
Copy link
Collaborator Author

@eladiw if you also agree on DataDeletionTrigger, I will change the name in the new code as part of this PR, and will open another PR for changing the name in other places as well

@eladiw
Copy link
Contributor

eladiw commented Sep 13, 2022

DataDeletionTrigger sounds good. btw, are we only deleting the blob or the entire container?
I saw in one of the files an indication that it's the container...I will tag you.

@eladiw
Copy link
Contributor

eladiw commented Sep 13, 2022

approved. as discussed, in the next PR we will align all the ToDelete to DataDeletion...

@yuvalyaron
Copy link
Collaborator Author

/test

@github-actions
Copy link

🤖 pr-bot 🤖

🏃 Running tests: https://github.com/microsoft/AzureTRE/actions/runs/3045331636 (with refid a4724aba)

(in response to this comment from @yuvalyaron)

@yuvalyaron
Copy link
Collaborator Author

renaming will be done in PR #2592

@yuvalyaron yuvalyaron deleted the feature/1968-airlock-handle-request-cancellation branch September 13, 2022 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Airlock processor handles request cancellation
3 participants