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

Initial Request Tracing Implementation #1093

Merged
merged 6 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions genie-agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ dependencies {
*******************************/

implementation("io.grpc:grpc-netty")
implementation("io.zipkin.brave:brave")
implementation("io.zipkin.brave:brave-instrumentation-grpc")
implementation("org.apache.commons:commons-lang3")
implementation("org.hibernate.validator:hibernate-validator")
implementation("org.slf4j:slf4j-api")
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-log4j2")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.cloud:spring-cloud-starter-aws")
implementation("org.springframework.cloud:spring-cloud-starter-sleuth")

/*******************************
* Compile Only Dependencies
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package com.netflix.genie.agent.cli;

/**
* Interface for argument classes used by {@ref ArgumentParser}.
* Interface for argument classes used by {@link ArgumentParser}.
*
* @author mprimi
* @since 4.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,19 @@
* @since 4.0.0
*/
@Configuration
@EnableConfigurationProperties({
AgentProperties.class
})
@EnableConfigurationProperties(
{
AgentProperties.class
}
)
public class CliAutoConfiguration {
/**
* Provide a bean for cache command line arguments.
*
* @return a {@link CacheArgumentsImpl} instance
*/
@Bean
public ArgumentDelegates.CacheArguments cacheArgumentsDelegate() {
public CacheArgumentsImpl cacheArgumentsDelegate() {
return new CacheArgumentsImpl();
}

Expand Down Expand Up @@ -250,7 +252,7 @@ public MainCommandArguments mainCommandArguments() {
* @return An instance of {@link com.netflix.genie.agent.cli.ArgumentDelegates.JobRequestArguments}
*/
@Bean
public ArgumentDelegates.JobRequestArguments jobRequestArguments(final MainCommandArguments mainCommandArguments) {
public JobRequestArgumentsImpl jobRequestArguments(final MainCommandArguments mainCommandArguments) {
return new JobRequestArgumentsImpl(mainCommandArguments);
}

Expand Down Expand Up @@ -336,7 +338,7 @@ public ResolveJobSpecCommand resolveJobSpecCommand(
* @return A {@link ServerArgumentsImpl} instance
*/
@Bean
public ArgumentDelegates.ServerArguments serverArguments() {
public ServerArgumentsImpl serverArguments() {
return new ServerArgumentsImpl();
}

Expand All @@ -346,7 +348,7 @@ public ArgumentDelegates.ServerArguments serverArguments() {
* @return A {@link CleanupArgumentsImpl} instance
*/
@Bean
public ArgumentDelegates.CleanupArguments cleanupArguments() {
public CleanupArgumentsImpl cleanupArguments() {
return new CleanupArgumentsImpl();
}

Expand All @@ -356,7 +358,7 @@ public ArgumentDelegates.CleanupArguments cleanupArguments() {
* @return A {@link RuntimeConfigurationArgumentsImpl} instance
*/
@Bean
public ArgumentDelegates.RuntimeConfigurationArguments runtimeConfigurationArguments() {
public RuntimeConfigurationArgumentsImpl runtimeConfigurationArguments() {
return new RuntimeConfigurationArgumentsImpl();
}

Expand All @@ -368,7 +370,7 @@ public ArgumentDelegates.RuntimeConfigurationArguments runtimeConfigurationArgum
@Bean
@ConditionalOnClass(name = {"org.apache.logging.log4j.core.LoggerContext"})
@ConditionalOnMissingBean(AgentLogManager.class)
public AgentLogManager agentLogManagerLog4j2() {
public AgentLogManagerLog4j2Impl agentLogManagerLog4j2() {
return new AgentLogManagerLog4j2Impl(
(org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,18 @@ class InfoCommand implements AgentCommand {

@Override
public ExitCode run() {

final StringBuilder messageBuilder = new StringBuilder();

messageBuilder
.append("Agent info:")
.append(NEWLINE)
.append(" version:")
.append(" version: ")
.append(agentMetadata.getAgentVersion())
.append(NEWLINE)
.append(" host:")
.append(" host: ")
.append(agentMetadata.getAgentHostName())
.append(NEWLINE)
.append(" pid:")
.append(" pid: ")
.append(agentMetadata.getAgentPid())
.append(NEWLINE);

Expand Down Expand Up @@ -208,7 +207,7 @@ public ExitCode run() {
createStateMachineDotGraph(stages, messageBuilder);
}

System.out.println(messageBuilder.toString());
System.out.println(messageBuilder);

return ExitCode.SUCCESS;
}
Expand All @@ -217,7 +216,6 @@ private void createStateMachineDotGraph(
final List<ExecutionStage> stages,
final StringBuilder messageBuilder
) {

final List<States> states = Lists.newArrayList();

states.add(States.INITIAL_STATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.netflix.genie.agent.execution.services.JobSetupService;
import com.netflix.genie.agent.execution.statemachine.ExecutionContext;
import com.netflix.genie.agent.execution.statemachine.ExecutionStage;
import com.netflix.genie.agent.execution.statemachine.JobExecutionStateMachine;
import com.netflix.genie.agent.execution.statemachine.JobExecutionStateMachineImpl;
import com.netflix.genie.agent.execution.statemachine.States;
import com.netflix.genie.agent.execution.statemachine.listeners.ConsoleLogListener;
Expand Down Expand Up @@ -127,9 +126,19 @@ ExecutionContext executionContext(final AgentProperties agentProperties) {
return new ExecutionContext(agentProperties);
}

/**
* Provide the default job execution state machine instance which will handle the entire lifecycle of the job
* this agent instance is responsible for.
*
* @param executionStages The available stages
* @param executionContext The context object for sharing state
* @param listeners Any listeners that may be in the system to react to events
* @param jobProcessManager The process manager for the actual client job
* @return a {@link JobExecutionStateMachineImpl} instance
*/
@Bean
@Lazy
JobExecutionStateMachine jobExecutionStateMachine(
JobExecutionStateMachineImpl jobExecutionStateMachine(
@NotEmpty final List<ExecutionStage> executionStages,
final ExecutionContext executionContext,
final Collection<JobExecutionListener> listeners,
Expand Down