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

Hop server enhancement #4569 #4574

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ public enum HopExtensionPoint {
BeforeCheckTransform("Right before a transform is about to be verified."),
AfterCheckTransform("After a transform has been checked for warnings/errors."),

HopServerInit("Right before the Hop webserver starts"),
HopServerStartup("Right after the Hop webserver has started and is fully functional"),
HopServerShutdown("Right before the Hop webserver will shut down"),
HopServerInit("Right before the Hop server starts"),
HopServerStartup("Right after the Hop server has started and is fully functional"),
HopServerShutdown("Right before the Hop server will shutdown"),
HopServerTerminate("Right after the Hop server shutdown"),
HopServerCalculateFilename(
"Right after the server configuration filename is determined, before it is used"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.hop.core.annotations.HopServerServlet;
import org.apache.hop.www.IHopServerPlugin;

/** This class represents the carte plugin type. */
/** This class represents the Hop server plugin type. */
@PluginMainClassType(IHopServerPlugin.class)
@PluginAnnotationType(HopServerServlet.class)
public class HopServerPluginType extends BasePluginType<HopServerServlet> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.apache.hop.server.HopServerMeta;
import org.apache.hop.www.GetExecutionInfoServlet;
import org.apache.hop.www.RegisterExecutionInfoServlet;
import org.apache.hop.www.RemoteHopServer;
import org.apache.http.client.utils.URIBuilder;

@GuiPlugin(description = "File execution information location GUI elements")
Expand Down Expand Up @@ -81,7 +82,7 @@ public class RemoteExecutionInfoLocation implements IExecutionInfoLocation {
@HopMetadataProperty(key = "location")
protected String locationName;

private HopServerMeta server;
private RemoteHopServer server;
private ExecutionInfoLocation location;
private IVariables variables;

Expand All @@ -105,9 +106,11 @@ public void initialize(IVariables variables, IHopMetadataProvider metadataProvid
this.variables = variables;
try {
if (StringUtils.isNotEmpty(serverName)) {
server =
HopServerMeta serverMeta =
metadataProvider.getSerializer(HopServerMeta.class).load(variables.resolve(serverName));
server = new RemoteHopServer(serverMeta);
}

if (StringUtils.isNotEmpty(locationName)) {
location =
metadataProvider
Expand Down Expand Up @@ -488,15 +491,6 @@ public void setPluginName(String pluginName) {
this.pluginName = pluginName;
}

/**
* Gets server
*
* @return value of server
*/
public HopServerMeta getServer() {
return server;
}

/**
* Gets serverName
*
Expand Down Expand Up @@ -551,15 +545,6 @@ public void setVariables(IVariables variables) {
this.variables = variables;
}

/**
* Sets server
*
* @param server value of server
*/
public void setServer(HopServerMeta server) {
this.server = server;
}

/**
* Gets location
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
import org.apache.hop.www.PrepareExecutionPipelineServlet;
import org.apache.hop.www.RegisterPackageServlet;
import org.apache.hop.www.RegisterPipelineServlet;
import org.apache.hop.www.RemoteHopServer;
import org.apache.hop.www.SniffTransformServlet;
import org.apache.hop.www.StartExecutionPipelineServlet;
import org.apache.hop.www.WebResult;
Expand Down Expand Up @@ -126,7 +127,7 @@ public class RemotePipelineEngine extends Variables implements IPipelineEngine<P
protected EngineMetrics engineMetrics;
protected Result previousResult;

protected HopServerMeta hopServer;
protected RemoteHopServer hopServer;

protected ILoggingObject parent;
protected IPipelineEngine<PipelineMeta> parentPipeline;
Expand Down Expand Up @@ -242,10 +243,12 @@ public void prepareExecution() throws HopException {
serverPollInterval =
Const.toLong(resolve(remotePipelineRunConfiguration.getServerPollInterval()), 2000L);

hopServer = metadataProvider.getSerializer(HopServerMeta.class).load(hopServerName);
if (hopServer == null) {
HopServerMeta hopServerMeta =
metadataProvider.getSerializer(HopServerMeta.class).load(hopServerName);
if (hopServerMeta == null) {
throw new HopException("Hop server '" + hopServerName + "' could not be found");
}
hopServer = new RemoteHopServer(hopServerMeta);

PipelineExecutionConfiguration pipelineExecutionConfiguration =
new PipelineExecutionConfiguration();
Expand Down Expand Up @@ -308,7 +311,7 @@ private void sendToHopServer(

executionConfiguration.getParametersMap().putAll(params);

hopServer.getLogChannel().setLogLevel(executionConfiguration.getLogLevel());
hopServer.getLog().setLogLevel(executionConfiguration.getLogLevel());

try {
if (remotePipelineRunConfiguration.isExportingResources()) {
Expand Down Expand Up @@ -502,7 +505,7 @@ public void run() {
private synchronized void getPipelineStatus() throws RuntimeException {
try {
HopServerPipelineStatus pipelineStatus =
hopServer.getPipelineStatus(this, subject.getName(), containerId, lastLogLineNr);
hopServer.requestPipelineStatus(this, subject.getName(), containerId, lastLogLineNr);
synchronized (engineMetrics) {
hasHaltedComponents = false;
engineMetrics.setStartDate(pipelineStatus.getExecutionStartDate());
Expand Down Expand Up @@ -648,7 +651,7 @@ public void waitUntilFinished() {
@Override
public void stopAll() {
try {
hopServer.stopPipeline(this, subject.getName(), containerId);
hopServer.requestStopPipeline(this, subject.getName(), containerId);
getPipelineStatus();
} catch (Exception e) {
throw new RuntimeException(
Expand All @@ -664,7 +667,7 @@ public boolean hasHaltedComponents() {
@Override
public void pauseExecution() {
try {
hopServer.pauseResumePipeline(this, subject.getName(), containerId);
hopServer.requestPauseResumePipeline(this, subject.getName(), containerId);
getPipelineStatus();
} catch (Exception e) {
throw new RuntimeException(
Expand Down Expand Up @@ -1328,22 +1331,6 @@ public void setLogChannel(ILogChannel log) {
this.logChannel = log;
}

/**
* Gets Hop server metadata
*
* @return value of Hop server
*/
public HopServerMeta getHopServer() {
return hopServer;
}

/**
* @param hopServer The hopServer to set
*/
public void setHopServer(HopServerMeta hopServer) {
this.hopServer = hopServer;
}

/**
* Gets engineMetrics
*
Expand Down
Loading
Loading