-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TSPS-86 - connecting to leonardo client (#40)
* add logic to connect to Leonardo java client * reorganize app and test folders * add PR readme template --------- Co-authored-by: Jose Soto <[email protected]>
- Loading branch information
1 parent
606c777
commit c1801f1
Showing
42 changed files
with
1,565 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### Description | ||
|
||
_Please replace this description with a concise description of this Pull Request._ | ||
|
||
### Jira Ticket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
service/src/main/java/bio/terra/pipelines/app/StartupInitializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...main/java/bio/terra/pipelines/app/configuration/external/LeonardoServerConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package bio.terra.pipelines.app.configuration.external; | ||
|
||
import java.time.Duration; | ||
import java.util.List; | ||
import org.broadinstitute.dsde.workbench.client.leonardo.model.AppType; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.ConstructorBinding; | ||
|
||
/** | ||
* @param baseUri - Leonardo URI to send requests to | ||
* @param wdsAppTypeNames - names used to signify what is the WDS app we want to use | ||
* @param cbasAppTypeNames - names used to signify what is the cbas app we want to use | ||
* @param dependencyUrlCacheTtl - how long (in seconds) to keep items in the cache | ||
* @param debugApiLogging | ||
*/ | ||
@ConfigurationProperties(prefix = "leonardo") | ||
public record LeonardoServerConfiguration( | ||
String baseUri, | ||
List<AppType> wdsAppTypeNames, | ||
List<AppType> cbasAppTypeNames, | ||
Duration dependencyUrlCacheTtl, | ||
Boolean debugApiLogging) { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(LeonardoServerConfiguration.class); | ||
|
||
@ConstructorBinding | ||
public LeonardoServerConfiguration( | ||
String baseUri, | ||
List<String> wdsAppTypeNames, | ||
List<String> cbasAppTypeNames, | ||
long dependencyUrlCacheTtlSeconds, | ||
Boolean debugApiLogging) { | ||
this( | ||
baseUri, | ||
wdsAppTypeNames.stream().map(AppType::fromValue).toList(), | ||
cbasAppTypeNames.stream().map(AppType::fromValue).toList(), | ||
Duration.ofSeconds(dependencyUrlCacheTtlSeconds), | ||
debugApiLogging); | ||
log.info("Setting wdsAppTypes={}", wdsAppTypeNames); | ||
log.info("Setting cbasAppTypeNames={}", cbasAppTypeNames); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ra/pipelines/config/SamConfiguration.java → ...figuration/external/SamConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...src/main/java/bio/terra/pipelines/app/configuration/internal/ImputationConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package bio.terra.pipelines.app.configuration.internal; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
/** configuration for all properties related to imputation */ | ||
@ConfigurationProperties(prefix = "imputation") | ||
public record ImputationConfiguration(String workspaceId) {} |
2 changes: 1 addition & 1 deletion
2
...uration/PipelinesSpringConfiguration.java → ...nternal/PipelinesSpringConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
service/src/main/java/bio/terra/pipelines/app/configuration/internal/RetryConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package bio.terra.pipelines.app.configuration.internal; | ||
|
||
import bio.terra.pipelines.retry.RetryLoggingListener; | ||
import java.net.SocketTimeoutException; | ||
import javax.ws.rs.ProcessingException; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.retry.RetryListener; | ||
import org.springframework.retry.annotation.EnableRetry; | ||
import org.springframework.retry.backoff.FixedBackOffPolicy; | ||
import org.springframework.retry.policy.ExceptionClassifierRetryPolicy; | ||
import org.springframework.retry.policy.NeverRetryPolicy; | ||
import org.springframework.retry.policy.SimpleRetryPolicy; | ||
import org.springframework.retry.support.RetryTemplate; | ||
|
||
/** bean used to retry requests made by the system */ | ||
@EnableRetry | ||
@Configuration | ||
public class RetryConfiguration { | ||
|
||
@Bean(name = "listenerResetRetryTemplate") | ||
public RetryTemplate listenerResetRetryTemplate() { | ||
RetryTemplate retryTemplate = new RetryTemplate(); | ||
|
||
// Fixed delay of 1 second between retries | ||
FixedBackOffPolicy fixedBackOffPolicy = new FixedBackOffPolicy(); | ||
fixedBackOffPolicy.setBackOffPeriod(1000L); | ||
|
||
// Inner retry (assumping the classifier hits): up to 3 times | ||
SimpleRetryPolicy srp = new SimpleRetryPolicy(); | ||
srp.setMaxAttempts(3); | ||
|
||
ExceptionClassifierRetryPolicy ecrp = new ExceptionClassifierRetryPolicy(); | ||
ecrp.setExceptionClassifier( | ||
exception -> { | ||
if (exception instanceof ProcessingException | ||
|| exception instanceof SocketTimeoutException) { | ||
return srp; | ||
} else { | ||
return new NeverRetryPolicy(); | ||
} | ||
}); | ||
|
||
retryTemplate.setBackOffPolicy(fixedBackOffPolicy); | ||
retryTemplate.setRetryPolicy(ecrp); | ||
retryTemplate.setThrowLastExceptionOnExhausted(true); | ||
retryTemplate.setListeners(new RetryListener[] {new RetryLoggingListener()}); | ||
|
||
return retryTemplate; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ines/config/StatusCheckConfiguration.java → ...on/internal/StatusCheckConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...figuration/TspsDatabaseConfiguration.java → ...n/internal/TspsDatabaseConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ipelines/config/VersionConfiguration.java → ...ration/internal/VersionConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
service/src/main/java/bio/terra/pipelines/dependencies/common/HealthCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package bio.terra.pipelines.dependencies.common; | ||
|
||
public interface HealthCheck { | ||
|
||
record Result(boolean isOk, String message) {} | ||
|
||
Result checkHealth(); | ||
} |
Oops, something went wrong.