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

TSPS-138 add cbas client integration #49

Merged
merged 2 commits into from
Jan 23, 2024
Merged

TSPS-138 add cbas client integration #49

merged 2 commits into from
Jan 23, 2024

Conversation

jsotobroad
Copy link
Collaborator

Description

This adds the ability to interact with the cbas client for a given workspace. Currently only added the function to list all methods available. Future work will add more functions as needed

Jira Ticket

https://broadworkbench.atlassian.net/browse/TSPS-138

@@ -35,6 +35,9 @@ dependencies {
implementation "bio.terra:terra-common-lib" // 0.0.94-SNAPSHOT is defined in bio.terra.pipelines.java-common-conventions.gradle
implementation "bio.terra:terra-resource-buffer-client:0.4.3-SNAPSHOT"

// hk2 is required to use cbas client, but not correctly exposed by the client
implementation group: "org.glassfish.jersey.inject", name: "jersey-hk2"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is pretty weird, i got this from workspace manager https://github.com/DataBiosphere/terra-workspace-manager/blob/a376aad7a021f648d7d688ba9d0555ca54ff9f1a/service/gradle/dependencies.gradle#L42 but I think we should be able to fix it on the cbas client end

Copy link
Collaborator

Choose a reason for hiding this comment

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

should we make tickets to make the fix in the cbas client and update this as necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@mmorgantaylor mmorgantaylor left a comment

Choose a reason for hiding this comment

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

really nice and clear, thanks!

T execute() throws ApiException;
}

@SuppressWarnings("java:S125") // The comment here isn't "commented code"
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need this? I don't see any comments

@@ -35,6 +35,9 @@ dependencies {
implementation "bio.terra:terra-common-lib" // 0.0.94-SNAPSHOT is defined in bio.terra.pipelines.java-common-conventions.gradle
implementation "bio.terra:terra-resource-buffer-client:0.4.3-SNAPSHOT"

// hk2 is required to use cbas client, but not correctly exposed by the client
implementation group: "org.glassfish.jersey.inject", name: "jersey-hk2"
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we make tickets to make the fix in the cbas client and update this as necessary?

return apiClient;
}

PublicApi publicApi(String cbasBaseUri, String accessToken) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

it'd be helpful to have a brief comment for each of these describing what functionality each is used for

@@ -61,13 +68,29 @@ public List<ListAppResponse> queryForWorkspaceApps() {
samService.getTspsServiceAccountToken(),
imputationConfiguration.workspaceId()));

// cbas related calls
Copy link
Collaborator

Choose a reason for hiding this comment

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

just to remind myself, this whole method queryForWorkspaceApps() is just a placeholder to make these calls and show they're working, right? eventually these will be moved into flight steps and the uris will be used to make calls etc etc

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup yup exactly

@Autowired CbasConfiguration cbasConfiguration;

@Test
void verifySamServerConfig() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: update copy pasta (Sam -> Cbas)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

whoops

PublicApi publicApi = cbasClient.publicApi(cbasBaseUri, authToken);

assertEquals(cbasBaseUri, publicApi.getApiClient().getBasePath());
assertTrue(publicApi.getApiClient().isDebugging());
Copy link
Collaborator

Choose a reason for hiding this comment

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

what sets this to True? is that the default that the CBAS client sets? I guess what I'm really asking is, why are we testing this?

Copy link
Collaborator Author

@jsotobroad jsotobroad Jan 22, 2024

Choose a reason for hiding this comment

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

its set to true in the application-test.yml file but realistically there isnt any reason to test this simple of a config. Pretty much just wrote it cuz it was easy and if we ever decide to something more complicated (like the leonardo config) we'll have this set up already

.thenAnswer(errorAnswer)
.thenAnswer(errorAnswer)
.thenAnswer(errorAnswer)
.thenReturn(expectedResponse);
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: maybe add a comment somewhere that the max number of attempts is defined as 3 in RetryConfiguration (this is the kind of thing that now that i've looked this up i'll never have this question again, but coming to this fresh it took me a few minutes to track that down. so not a huge deal, just would be helpful.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added!

@jsotobroad jsotobroad force-pushed the js_TSPS-138 branch 2 times, most recently from c97a013 to 7f309a0 Compare January 23, 2024 20:44
Copy link

sonarcloud bot commented Jan 23, 2024

@jsotobroad jsotobroad merged commit 9116527 into main Jan 23, 2024
13 checks passed
@jsotobroad jsotobroad deleted the js_TSPS-138 branch January 23, 2024 22:06
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.

2 participants