-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
@@ -271,7 +273,7 @@ class MockRawlsDAO extends RawlsDAO { | |||
WorkspaceDetails( | |||
namespace = "namespace", | |||
name = "name", | |||
workspaceId = "workspaceId", | |||
workspaceId = mockWorkspaceId, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
(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 |
There was a problem hiding this comment.
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.
8dc16ff
to
40d1baf
Compare
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL
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
40d1baf
to
963d780
Compare
@@ -38,7 +38,7 @@ TODO: update `render-local-env.sh` so it doesn't require manual code changes | |||
|
|||
##### Testing against your own FiaB | |||
|
There was a problem hiding this comment.
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 | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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:
LegacyFileTypes
toCwdsDao
(Manual refactor)MockCwdsDao
likeMockImportServiceDao
(manual)importServiceDao.getJobV1
(manual)importServiceDao.listJobsV1
(manual)importV1
from ImportService: and then make all the testsstill pass for vaguely the same reasons as before, except using cWDS.
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: