FIRST-Tech-Challenge / fmltc

FIRST Machine Learning Toolchain
Other
38 stars 14 forks source link

Use cloud run for two requests that take longer than 5 seconds #241

Closed lizlooney closed 1 year ago

lizlooney commented 2 years ago

Added instructions to README.md to setup cloud run, including creating a secret key to authenticate requests.

Added scripts/deploy_cloud_run.sh to deploy to cloud run. Modified scripts/deploy_gae.sh to use .app_engine_ignore. Modified scripts/deploy_cloud_function.sh to use .cloud_function_ignore. Moved validation functions from app_engine.py to validate.py Moved strip and sanitize functions from app_engine.py to strip.py Pass cloud_run_url and encoded_jwt to labelVideo.html/labelVideo.js and monitorTraining.html/monitorTraining.js. Added main_cloud_run.py with handlers for /retrieveVideoFrameEntitiesWithImageUrls and /retrieveSummaryItems. Use cloud_run_url for /retrieveVideoFrameEntitiesWithImageUrls and /retrieveSummaryItems requests.

github-actions[bot] commented 2 years ago

Terraform plan Succeeded for Workspace: default

Show Output ```diff An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: ! update in-place -/+ destroy and then create replacement Terraform will perform the following actions: # module.dev.google_app_engine_standard_app_version.fmltc-app-v1 will be updated in-place ! resource "google_app_engine_standard_app_version" "fmltc-app-v1" { id = "apps/ftc-ml-firstinspires-dev/services/default/versions/v1" name = "apps/ftc-ml-firstinspires-dev/services/default/versions/v1" # (9 unchanged attributes hidden) ! automatic_scaling { ! min_pending_latency = "0.100s" -> "0.1s" # (4 unchanged attributes hidden) # (1 unchanged block hidden) } ! deployment { ! zip { ! source_url = "https://storage.googleapis.com/ftc-ml-firstinspires-dev-gae-source/f0ce8f383ea5393c4b7220ddf5a089f3.zip" -> "https://storage.googleapis.com/ftc-ml-firstinspires-dev-gae-source/9be0a8582b1e41fd97dfb3df8fbf0493.zip" # (1 unchanged attribute hidden) } } - handlers { - auth_fail_action = "AUTH_FAIL_ACTION_REDIRECT" -> null - login = "LOGIN_OPTIONAL" -> null - security_level = "SECURE_OPTIONAL" -> null - url_regex = ".*" -> null - script { - script_path = "auto" -> null } } # (8 unchanged blocks hidden) } # module.dev.google_cloudfunctions_function.perform-action will be updated in-place ! resource "google_cloudfunctions_function" "perform-action" { id = "projects/ftc-ml-firstinspires-dev/locations/us-central1/functions/perform_action" name = "perform_action" ! source_archive_object = "8104dd5fcb6f3a748410f4e8afc7f23f.zip" -> "efffa35f03798a5aa3827323b497f416.zip" # (13 unchanged attributes hidden) # (2 unchanged blocks hidden) } # module.dev.google_storage_bucket.fmltc-blobs will be updated in-place ! resource "google_storage_bucket" "fmltc-blobs" { id = "ftc-ml-firstinspires-dev-blobs" name = "ftc-ml-firstinspires-dev-blobs" # (11 unchanged attributes hidden) - cors { - max_age_seconds = 3600 -> null - method = [ - "GET", ] -> null - origin = [ - "https://ftc-ml-dev.firstinspires.org", ] -> null - response_header = [ - "Content-Type", ] -> null } } # module.dev.google_storage_bucket_object.app-server-archive must be replaced -/+ resource "google_storage_bucket_object" "app-server-archive" { ! content_type = "application/zip" -> (known after apply) ! crc32c = "G1sgbQ==" -> (known after apply) ! detect_md5hash = "8M6POD6lOTxLciDd9aCJ8w==" -> "different hash" # forces replacement - event_based_hold = false -> null ! id = "ftc-ml-firstinspires-dev-gae-source-f0ce8f383ea5393c4b7220ddf5a089f3.zip" -> (known after apply) + kms_key_name = (known after apply) ! md5hash = "8M6POD6lOTxLciDd9aCJ8w==" -> (known after apply) ! media_link = "https://storage.googleapis.com/download/storage/v1/b/ftc-ml-firstinspires-dev-gae-source/o/f0ce8f383ea5393c4b7220ddf5a089f3.zip?generation=1639703239781549&alt=media" -> (known after apply) - metadata = {} -> null ! name = "f0ce8f383ea5393c4b7220ddf5a089f3.zip" -> "9be0a8582b1e41fd97dfb3df8fbf0493.zip" # forces replacement ! output_name = "f0ce8f383ea5393c4b7220ddf5a089f3.zip" -> (known after apply) ! self_link = "https://www.googleapis.com/storage/v1/b/ftc-ml-firstinspires-dev-gae-source/o/f0ce8f383ea5393c4b7220ddf5a089f3.zip" -> (known after apply) ! storage_class = "STANDARD" -> (known after apply) - temporary_hold = false -> null # (2 unchanged attributes hidden) } # module.dev.google_storage_bucket_object.closure_js must be replaced -/+ resource "google_storage_bucket_object" "closure_js" { ! crc32c = "WbYIOw==" -> (known after apply) ! detect_md5hash = "G6fjfylKZVzbnJEXCVJELw==" -> "different hash" # forces replacement - event_based_hold = false -> null ! id = "ftc-ml-firstinspires-dev-compiled/js/fmltc.js" -> (known after apply) + kms_key_name = (known after apply) ! md5hash = "G6fjfylKZVzbnJEXCVJELw==" -> (known after apply) ! media_link = "https://storage.googleapis.com/download/storage/v1/b/ftc-ml-firstinspires-dev/o/compiled%2Fjs%2Ffmltc.js?generation=1638568232144119&alt=media" -> (known after apply) - metadata = {} -> null name = "compiled/js/fmltc.js" ! output_name = "compiled/js/fmltc.js" -> (known after apply) ! self_link = "https://www.googleapis.com/storage/v1/b/ftc-ml-firstinspires-dev/o/compiled%2Fjs%2Ffmltc.js" -> (known after apply) ! storage_class = "STANDARD" -> (known after apply) - temporary_hold = false -> null # (3 unchanged attributes hidden) } # module.dev.google_storage_bucket_object.cloud-function-archive must be replaced -/+ resource "google_storage_bucket_object" "cloud-function-archive" { ! content_type = "application/zip" -> (known after apply) ! crc32c = "boq3aw==" -> (known after apply) ! detect_md5hash = "gQTdX8tvOnSEEPTor8fyPw==" -> "different hash" # forces replacement - event_based_hold = false -> null ! id = "ftc-ml-firstinspires-dev-gcf-source-8104dd5fcb6f3a748410f4e8afc7f23f.zip" -> (known after apply) + kms_key_name = (known after apply) ! md5hash = "gQTdX8tvOnSEEPTor8fyPw==" -> (known after apply) ! media_link = "https://storage.googleapis.com/download/storage/v1/b/ftc-ml-firstinspires-dev-gcf-source/o/8104dd5fcb6f3a748410f4e8afc7f23f.zip?generation=1639703239801468&alt=media" -> (known after apply) - metadata = {} -> null ! name = "8104dd5fcb6f3a748410f4e8afc7f23f.zip" -> "efffa35f03798a5aa3827323b497f416.zip" # forces replacement ! output_name = "8104dd5fcb6f3a748410f4e8afc7f23f.zip" -> (known after apply) ! self_link = "https://www.googleapis.com/storage/v1/b/ftc-ml-firstinspires-dev-gcf-source/o/8104dd5fcb6f3a748410f4e8afc7f23f.zip" -> (known after apply) ! storage_class = "STANDARD" -> (known after apply) - temporary_hold = false -> null # (2 unchanged attributes hidden) } Plan: 3 to add, 3 to change, 3 to destroy. ```
lizlooney commented 2 years ago

@cmacfarl Take a look at this PR and let me know what you think. I didn't do any terraform stuff.