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-360 Add steps to calculate quota consumed #158

Merged
merged 4 commits into from
Nov 15, 2024
Merged

Conversation

jsotobroad
Copy link
Collaborator

Description

This PR adds the logic to calculate how much quota the currently pipeline should consume. It does it by running a "QuotaConsumed" wdl found in the workspace specified to the flight, polling it, and then extracting the value from the data tables.

Successful runs of this flight can be found here. Note now each imputation flight will launch 2 workflows.

Jira Ticket

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

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.

looks great, just a couple suggestions and questions for my curiosity

@ConfigurationProperties(prefix = "pipelines.wdl")
@Getter
@Setter
public class WdlPipelineConfiguration {
Copy link
Collaborator

Choose a reason for hiding this comment

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

noticing you named this pretty generically. what else do you see adding to this configuration besides quotaConsumedPollingIntervalSeconds?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure but i didnt want it associated with imputation - happy to put it in an already existing configuration that wasnt imputations. I imagine there will be a couple of things we'll want to move out of imputation config to this one once we get our next wdl pipeline.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah sounds good. no need to combine with an existing configuration.

* specifically fetches the quota consumed value from the data table row using the quota_consumed
* key
*
* <p>This step expects nothign from the working map
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* <p>This step expects nothign from the working map
* <p>This step expects nothing from the working map

new InternalServerErrorException("Quota consumed is unexpectedly null"));
}

logger.info("Quota consumed: {}", quotaConsumed);
Copy link
Collaborator

Choose a reason for hiding this comment

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

is the idea that in future we'll store this in the working map to be used by the logic to do the quota check in a subsequent step?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i think we may do the quota check here or in a subsequent step - thats due to be done in https://broadworkbench.atlassian.net/browse/TSPS-361. I'd prob do it here and rename the step

QUOTA_CONSUMED_OUTPUT_DEFINITION_LIST,
pipelineName);

// if there is a validation response that means the validation failed so return it
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is elegant! nice!

.entityType(
pipelineName.getValue()) // this must match the configuration the method is set to
// launch with. Will be addressed in
// https://broadworkbench.atlassian.net/browse/TSPS-301
Copy link
Collaborator

Choose a reason for hiding this comment

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

TSPS-301 is closed duplicate of TSPS-303, which is complete. can we remove this comment or is there still work to be done that wasn't done with TSPS-303? https://broadworkbench.atlassian.net/browse/TSPS-303

(I'm not really sure what the issue is here that needs to be addressed)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh yea this is solved - will remove. This is part of the "magic" validation/updating of the method configuration

// make sure the step was a success
assertEquals(StepStatus.STEP_RESULT_SUCCESS, result.getStepStatus());
assertEquals(
testJobId,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this shouldn't be the testJobId, should be a different uuid (related to comment above)

submissionRequestCaptor.capture(),
eq(TestUtils.CONTROL_WORKSPACE_BILLING_PROJECT),
eq(TestUtils.CONTROL_WORKSPACE_NAME)))
.thenReturn(new SubmissionReport().submissionId(testJobId.toString()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

it probably doesn't really matter for the test, but to avoid confusion down the line we should make a new randomUUID (like you do in PollQuotaConsumedSubmissionStatusStepTest.java) to use for the submissionId for the quota submission. it's not going to be the same as the flight jobId.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

great point, updating both tests

any(SubmissionRequest.class),
eq(TestUtils.CONTROL_WORKSPACE_BILLING_PROJECT),
eq(TestUtils.CONTROL_WORKSPACE_NAME)))
.thenReturn(new SubmissionReport().submissionId(testJobId.toString()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment here, should use a new uuid

RawlsService rawlsService,
SamService samService,
Copy link
Collaborator

Choose a reason for hiding this comment

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

just curious why the reorder?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

all the other steps have rawls then sam and it annoyed me this one was different 😄

Copy link

sonarcloud bot commented Nov 15, 2024

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.

looks great, thanks!

@ConfigurationProperties(prefix = "pipelines.wdl")
@Getter
@Setter
public class WdlPipelineConfiguration {
Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah sounds good. no need to combine with an existing configuration.

@jsotobroad jsotobroad merged commit ca723c8 into main Nov 15, 2024
14 checks passed
@jsotobroad jsotobroad deleted the js_TSPS-360 branch November 15, 2024 16:57
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