-
Notifications
You must be signed in to change notification settings - Fork 373
Make Genie agent container's entry point and command dynamic #1251
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,6 +273,60 @@ class TitusAgentLauncherImplSpec extends Specification { | |
return new ObjectMapper().readValue(s, TitusBatchJobResponse.class) | ||
} | ||
|
||
def "Check container entrypoint and command resolution"() { | ||
TitusBatchJobResponse response = toTitusResponse("{ \"id\" : \"" + TITUS_JOB_ID + "\" }") | ||
TitusBatchJobRequest requestCapture | ||
|
||
when: | ||
Optional<JsonNode> launcherExt = launcher.launchAgent(resolvedJob, null) | ||
|
||
then: | ||
1 * restTemplate.postForObject(TITUS_ENDPOINT, _ as TitusBatchJobRequest, TitusBatchJobResponse.class) >> { | ||
args -> | ||
requestCapture = args[1] as TitusBatchJobRequest | ||
return response | ||
} | ||
1 * adapter.modifyJobRequest(_ as TitusBatchJobRequest, resolvedJob) | ||
1 * cache.put(JOB_ID, TITUS_JOB_ID) | ||
launcherExt.isPresent() | ||
requestCapture != null | ||
requestCapture.getContainer().getEntryPoint() == ["/bin/genie-agent"] | ||
requestCapture.getContainer().getCommand() == [ | ||
"exec", | ||
"--api-job", | ||
"--launchInJobDirectory", | ||
"--job-id", JOB_ID, | ||
"--server-host", launcherProperties.getGenieServerHost(), | ||
"--server-port", launcherProperties.getGenieServerPort().toString() | ||
] | ||
|
||
when: | ||
def entryPointTemplate = ["my", "entrypoint"] | ||
def commandTemplate = ["my", "command"] | ||
environment.withProperty( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if the property is malformed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, the Titus container will still launch, but it will fail finally. This change is mainly intended to help with testing and rolling out changes related to the entry point or command. The default values are stored in property files like application.yml, so we don't anticipate needing a long-term fast property for this scenario. |
||
TitusAgentLauncherProperties.ENTRY_POINT_TEMPLATE, | ||
entryPointTemplate.join(",") | ||
) | ||
environment.withProperty( | ||
TitusAgentLauncherProperties.COMMAND_TEMPLATE, | ||
commandTemplate.join(",") | ||
) | ||
launcherExt = launcher.launchAgent(resolvedJob, null) | ||
|
||
then: | ||
1 * restTemplate.postForObject(TITUS_ENDPOINT, _ as TitusBatchJobRequest, TitusBatchJobResponse.class) >> { | ||
args -> | ||
requestCapture = args[1] as TitusBatchJobRequest | ||
return response | ||
} | ||
1 * adapter.modifyJobRequest(_ as TitusBatchJobRequest, resolvedJob) | ||
1 * cache.put(JOB_ID, TITUS_JOB_ID) | ||
launcherExt.isPresent() | ||
requestCapture != null | ||
requestCapture.getContainer().getEntryPoint() == entryPointTemplate | ||
requestCapture.getContainer().getCommand() == commandTemplate | ||
} | ||
|
||
@Unroll | ||
def "Check memory allocation logic"() { | ||
if (envMinimumMemory != null) { | ||
|
Uh oh!
There was an error while loading. Please reload this page.