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

AJ-1749 Remove import-service from firecloud-orchestration #1355

Merged
merged 2 commits into from
May 22, 2024

Conversation

jladieu
Copy link
Contributor

@jladieu jladieu commented May 10, 2024

Remove import service. Once https://github.com/broadinstitute/terra-helmfile/pull/5556 is live, cWDS will effectively field 100% of import traffic and all import-service backend resources will be deactivated.

Process:

  • Rename ImportServiceTypes -> LegacyServiceTypes (IDE refactor only)
  • Move LegacyFileTypes to CwdsDao (Manual refactor)
  • Rename ImportServiceDAO methods to match CwdsDao (IDE refactor only)
  • Make MockCwdsDao like MockImportServiceDao (manual)
  • Eliminate importServiceDao.getJobV1 (manual)
  • Eliminate importServiceDao.listJobsV1 (manual)
  • Remove importV1 from ImportService: and then make all the tests
    still pass for vaguely the same reasons as before, except using cWDS.
  • Prune references to ImportService
  • Make supportedFormats consistent

Related PRs:

I, the developer opening this PR, do solemnly pinky swear that:

  • I've followed the instructions if I've made any changes to the API, especially if they're breaking changes (N/A)
  • I've updated the RC_XXX release ticket with any manual steps required to release this change (N/A)
  • I've updated the FISMA documentation if I've made any security-related changes, including auth, encryption, or auditing (N/A)

In all cases:

  • Get two thumbsworth of review and PO signoff if necessary
  • Verify all tests go green
  • Squash and merge; you can delete your branch after this unless it's for a hotfix. In that case, don't delete it!
  • Test this change deployed correctly and works on dev environment after deployment

@@ -271,7 +273,7 @@ class MockRawlsDAO extends RawlsDAO {
WorkspaceDetails(
namespace = "namespace",
name = "name",
workspaceId = "workspaceId",
workspaceId = mockWorkspaceId,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed to switch this to a UUID to prevent an error attempting to initialize an actual UUID from the workspaceId

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

// Common things that can be accessed from tests
object MockRawlsDAO {

val mockWorkspaceId = UUID.randomUUID().toString
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made available for a couple tests to refer to it.

(Post(pfbImportPath, PFBImportRequest("https://bad.request.avro"))
~> dummyUserIdHeaders(dummyUserId)
~> sealRoute(workspaceRoutes)) ~> check {
status should equal(BadRequest)
responseAs[String] should include ("Bad request as reported by import service")
status should equal(InternalServerError) // TODO: bubble up 400 / BadRequest
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests verify current behavior in prod, however these tests used to verify what happened in the interaction to ImportService so I left these TODOs in place to trigger a conversation over whether we should continue to strive to resurface errors, or if we're okay with just bubbling up as InternalServerError. If we're okay with leaving this as is, I could get rid of the TODOs.

Copy link
Contributor

Choose a reason for hiding this comment

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

My vote would be to deprecate Orchestration's import related endpoints entirely and move everything to talk directly to CWDS.

Copy link
Contributor

Choose a reason for hiding this comment

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

For these APIs, I would much rather bubble up the actual error/response code instead of wrapping everything in a 500. Since this current PR does not change behavior, I'm fine making that change in a follow-on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For these APIs, I would much rather bubble up the actual error/response code instead of wrapping everything in a 500. Since this current PR does not change behavior, I'm fine making that change in a follow-on.

I plan to leave out any changes related to error handling from this PR, but wanted to highlight @nawatts 's suggestion here which is worth considering: #1355 (comment)

workspaceId: String,
importRequest: AsyncImportRequest
)(implicit userInfo: UserInfo): GenericJob = {
importRequest.filetype match {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied this logic over from MockImportServiceDAO and then swapped this in wherever tests relied on it when interacting with ImportService.

import org.databiosphere.workspacedata.client.ApiException
import org.databiosphere.workspacedata.model.GenericJob

object LegacyFileTypes {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pulled over from ImportServiceDAO which went away.

Copy link
Contributor

@nawatts nawatts May 22, 2024

Choose a reason for hiding this comment

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

👍 for calling these out as for backwards compatibility

@jladieu jladieu requested a review from a team May 10, 2024 19:23
@jladieu jladieu changed the title AJ-1749 Remove import-service from firecloud-orchestration DO_NOT_MERGE: AJ-1749 Remove import-service from firecloud-orchestration May 10, 2024
(Post(pfbImportPath, PFBImportRequest("https://bad.request.avro"))
~> dummyUserIdHeaders(dummyUserId)
~> sealRoute(workspaceRoutes)) ~> check {
status should equal(BadRequest)
responseAs[String] should include ("Bad request as reported by import service")
status should equal(InternalServerError) // TODO: bubble up 400 / BadRequest
Copy link
Contributor

Choose a reason for hiding this comment

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

My vote would be to deprecate Orchestration's import related endpoints entirely and move everything to talk directly to CWDS.

@jladieu jladieu force-pushed the aj-1749-remove-import-service branch from 8dc16ff to 40d1baf Compare May 20, 2024 21:01
@jladieu jladieu changed the title DO_NOT_MERGE: AJ-1749 Remove import-service from firecloud-orchestration AJ-1749 Remove import-service from firecloud-orchestration May 20, 2024
@jladieu jladieu requested a review from a team May 20, 2024 21:03
case (status, errorReport) =>
status shouldEqual StatusCodes.InternalServerError
errorReport.message should be("Unexpected error during async TSV import")
}
}

"should return error for (async=true) when import service returns sync error" in {
Copy link
Contributor

Choose a reason for hiding this comment

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

Test description should be "cwds" now, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for noticing this! This triggered an additional round of find/replace and I think I got them all this time.

else if (importRequest.url.contains("good")) makeJob(workspaceId)
else
throw new ApiException(
EnhanceYourCalm.intValue,
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL

jladieu added 2 commits May 22, 2024 10:00
Process:

* Rename ImportServiceTypes -> LegacyServiceTypes (IDE refactor only)
* Move `LegacyFileTypes` to `CwdsDao` (Manual refactor)
* Rename ImportServiceDAO methods to match CwdsDao (IDE refactor only)
* Make `MockCwdsDao` like `MockImportServiceDao` (manual)
* Eliminate `importServiceDao.getJobV1` (manual)
* Eliminate `importServiceDao.listJobsV1` (manual)
* Remove `importV1` from ImportService: and then make all the tests
still pass for vaguely the same reasons as before, except using cWDS.
* Prune references to ImportService
* Make supportedFormats consistent
* IDE: `{ImportService->Cwds}ListResponse`
* IDE: `{ImportService->Cwds}Response`
* Manual/IDE: Various methods/comments
@jladieu jladieu force-pushed the aj-1749-remove-import-service branch from 40d1baf to 963d780 Compare May 22, 2024 14:00
@jladieu jladieu requested review from calypsomatic and nawatts May 22, 2024 14:05
@@ -38,7 +38,7 @@ TODO: update `render-local-env.sh` so it doesn't require manual code changes

##### Testing against your own FiaB

Copy link
Contributor

Choose a reason for hiding this comment

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

Not fully relevant to this PR, but FiaBs don't exist anymore

server = "https://terra-importservice-dev.appspot.com"
bucketName = "import-service-batchupsert-dev"
enabled = true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

do you have a corresponding terra-helmfile PR to remove this stanza?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Post(pfbImportPath, PFBImportRequest("https://bad.request.avro"))
~> dummyUserIdHeaders(dummyUserId)
~> sealRoute(workspaceRoutes)) ~> check {
status should equal(BadRequest)
responseAs[String] should include ("Bad request as reported by import service")
status should equal(InternalServerError) // TODO: bubble up 400 / BadRequest
Copy link
Contributor

Choose a reason for hiding this comment

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

For these APIs, I would much rather bubble up the actual error/response code instead of wrapping everything in a 500. Since this current PR does not change behavior, I'm fine making that change in a follow-on.

@jladieu jladieu merged commit 681c7f5 into develop May 22, 2024
14 checks passed
@jladieu jladieu deleted the aj-1749-remove-import-service branch May 22, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants