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-303 validate method config and update if needed #121

Merged
merged 8 commits into from
Sep 11, 2024
Merged

Conversation

jsotobroad
Copy link
Collaborator

Description

We want to make sure we are using the correct wdl and inputs when submitting our pipelines. This PR adds the logic to the submission step in the flight make this possible.

Do we think this is too much to do in one step?

Jira Ticket

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

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 good to me so far!

// returns true if submission is in a running state
public static boolean submissionIsRunning(Submission submission) {
return !FINAL_RUN_STATES.contains(submission.getStatus());
}

/**
* validates a method config against the expected version, inputs, and outputs
Copy link
Collaborator

Choose a reason for hiding this comment

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

could use a little more description here - i like that you validate not only that the expected inputs and outputs are there, but also that they're pointed to the corresponding fields in the data table. if you could note that here that'd be great.

wdlMethodVersion);

// if not a valid method config, set the method config to what we think it should be. This
// shouldn't happen
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't happen often, but it will happen once every time we change the wdlMethodVersion... unless we update it in Terra as well as in our service, which actually we could do. 🤷 it's nice to have the warning log here. wonder if we should set up a slack channel to capture warnings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

is that something we can do -- is that a sentry thingy?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah probably sentry


// validate and extract parameters from working map
FlightMap workingMap = flightContext.getWorkingMap();

// grab current method config and validate it
MethodConfiguration methodConfiguration =
rawlsService.getCurrentMethodConfigForMethod(
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 want to wrap this in try-catch retry logic like the later rawls call?

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 good point, definitely missed this.

@jsotobroad jsotobroad marked this pull request as ready for review September 10, 2024 22:13
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.

mostly minor comments, one question about validating the root entity in the method config

// returns true if submission is in a running state
public static boolean submissionIsRunning(Submission submission) {
return !FINAL_RUN_STATES.contains(submission.getStatus());
}

/**
* validates a method config against the expected version, inputs, and outputs it does this by
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: missing period after "outputs"

// returns true if submission is in a running state
public static boolean submissionIsRunning(Submission submission) {
return !FINAL_RUN_STATES.contains(submission.getStatus());
}

/**
* validates a method config against the expected version, inputs, and outputs it does this by
* checking that the methodRepoMethod method version matches we expect and that all expected
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • "methodRepoMethod method version" can just be "wdlMethodVersion"
  • "matches what we expect"
  • (next line) "inputs outputs both exist" -> "inputs/outputs exist"

wdlMethodVersion);

// if not a valid method config, set the method config to what we think it should be. This
// shouldn't happen
Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah probably sentry

// shouldn't happen
if (!validMethodConfig) {
logger.warn(
"found method config that was not valid for billing project: {}, workspace: {}, method name: {}, methodConfigVersion: {}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: it's not necessarily "not valid" but it's not matching our expectations. super minor but to me "not valid" suggests there's an actual error in the setup

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

but to us there is an error in the setup no?

* @param wdlWorkflowName - name of the wdl workflow, used to construct the full wdl variable name
* @param pipelineInputDefinitions - list of input definitions for a pipeline
* @param pipelineOutputDefinitions - list of output definitions for a pipeline
* @param wdlMethodVersion - version of wdl we should be submitting
Copy link
Collaborator

Choose a reason for hiding this comment

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

also validate rootEntity (or whatever it's called) that defines which data table it should read from

.methodNamespace("namespace")
.methodVersion("1.2.3")
.methodUri("this/is/a/uri/with/a/version/1.2.3"));
// test wrong reference
Copy link
Collaborator

Choose a reason for hiding this comment

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

really like how you did this!

Jose Soto added 3 commits September 11, 2024 12:27
stop using any() for rawls service tests
Copy link

sonarcloud bot commented Sep 11, 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 awesome!!

@jsotobroad jsotobroad merged commit b22ca5e into main Sep 11, 2024
12 checks passed
@jsotobroad jsotobroad deleted the js_TSPS-303 branch September 11, 2024 18:37
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