Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoloboschi committed May 20, 2024
1 parent 9b5bd4c commit 4deeca9
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import ai.langstream.api.runner.topics.TopicConsumer;
import ai.langstream.api.runner.topics.TopicProducer;
import ai.langstream.api.runtime.ClusterRuntimeRegistry;
import ai.langstream.api.runtime.DeployContext;
import ai.langstream.api.runtime.PluginsRegistry;
import ai.langstream.api.storage.ApplicationStore;
import ai.langstream.apigateway.api.ConsumePushMessage;
Expand Down Expand Up @@ -658,6 +659,7 @@ private void prepareTopicsForTest(String... topic) throws Exception {
.pluginsRegistry(new PluginsRegistry())
.registry(new ClusterRuntimeRegistry())
.topicConnectionsRuntimeRegistry(topicConnectionsRuntimeRegistry)
.deployContext(DeployContext.NO_DEPLOY_CONTEXT)
.build();
final StreamingCluster streamingCluster = getStreamingCluster();
topicConnectionsRuntimeRegistry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import ai.langstream.api.model.StreamingCluster;
import ai.langstream.api.runner.topics.TopicConnectionsRuntimeRegistry;
import ai.langstream.api.runtime.ClusterRuntimeRegistry;
import ai.langstream.api.runtime.DeployContext;
import ai.langstream.api.runtime.PluginsRegistry;
import ai.langstream.api.storage.ApplicationStore;
import ai.langstream.apigateway.api.ConsumePushMessage;
Expand Down Expand Up @@ -267,6 +268,7 @@ private void prepareTopicsForTest(String... topic) throws Exception {
.pluginsRegistry(new PluginsRegistry())
.registry(new ClusterRuntimeRegistry())
.topicConnectionsRuntimeRegistry(topicConnectionsRuntimeRegistry)
.deployContext(DeployContext.NO_DEPLOY_CONTEXT)
.build();
final StreamingCluster streamingCluster = getStreamingCluster();
topicConnectionsRuntimeRegistry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,62 @@
*/
package ai.langstream.api.runtime;

import ai.langstream.api.runner.assets.AssetManagerRegistry;
import ai.langstream.api.webservice.application.ApplicationCodeInfo;

public interface DeployContext extends AutoCloseable {

default ApplicationCodeInfo getApplicationCodeInfo(
String tenant, String applicationId, String codeArchiveId) {
throw new UnsupportedOperationException();
}
DeployContext NO_DEPLOY_CONTEXT = new NoOpDeployContext();

default AssetManagerRegistry getAssetManagerRegistry() {
throw new UnsupportedOperationException();
}
class NoOpDeployContext implements DeployContext {

default boolean isAutoUpgradeRuntimeImage() {
return false;
}
@Override
public ApplicationCodeInfo getApplicationCodeInfo(
String tenant, String applicationId, String codeArchiveId) {
return null;
}

default boolean isAutoUpgradeRuntimeImagePullPolicy() {
return false;
}
@Override
public boolean isAutoUpgradeRuntimeImage() {
return false;
}

default boolean isAutoUpgradeAgentResources() {
return false;
}
@Override
public boolean isAutoUpgradeRuntimeImagePullPolicy() {
return false;
}

default boolean isAutoUpgradeAgentPodTemplate() {
return false;
}
@Override
public boolean isAutoUpgradeAgentResources() {
return false;
}

@Override
public boolean isAutoUpgradeAgentPodTemplate() {
return false;
}

default long getApplicationSeed() {
throw new UnsupportedOperationException();
@Override
public long getApplicationSeed() {
return -1L;
}

@Override
public void close() {}
}

ApplicationCodeInfo getApplicationCodeInfo(
String tenant, String applicationId, String codeArchiveId);

boolean isAutoUpgradeRuntimeImage();

boolean isAutoUpgradeRuntimeImagePullPolicy();

boolean isAutoUpgradeAgentResources();

boolean isAutoUpgradeAgentPodTemplate();

long getApplicationSeed();

@Override
default void close() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@
import ai.langstream.api.runner.topics.TopicConnectionsRuntime;
import ai.langstream.api.runner.topics.TopicConnectionsRuntimeAndLoader;
import ai.langstream.api.runner.topics.TopicConnectionsRuntimeRegistry;
import ai.langstream.api.runtime.ClusterRuntimeRegistry;
import ai.langstream.api.runtime.ComputeClusterRuntime;
import ai.langstream.api.runtime.ExecutionPlan;
import ai.langstream.api.runtime.PluginsRegistry;
import ai.langstream.api.runtime.StreamingClusterRuntime;
import ai.langstream.api.runtime.*;
import ai.langstream.impl.noop.NoOpComputeClusterRuntimeProvider;
import ai.langstream.impl.parser.ModelBuilder;
import java.util.Map;
Expand Down Expand Up @@ -82,6 +78,7 @@ void testDeploy() throws Exception {
ApplicationDeployer.builder()
.pluginsRegistry(new PluginsRegistry())
.registry(registry)
.deployContext(DeployContext.NO_DEPLOY_CONTEXT)
.topicConnectionsRuntimeRegistry(
new TopicConnectionsRuntimeRegistry() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public void testCodeArchiveId() throws Exception {

ApplicationDeployer deployer =
getDeployer(
new DeployContext() {
new DeployContext.NoOpDeployContext() {
@Override
public ApplicationCodeInfo getApplicationCodeInfo(
String tenant, String applicationId, String codeArchiveId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private void assertCode(
String oldCode,
boolean expectKeep) {
final DeployContext deployContext =
new DeployContext() {
new DeployContext.NoOpDeployContext() {
@Override
public ApplicationCodeInfo getApplicationCodeInfo(
String tenant, String applicationId, String codeArchiveId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import ai.langstream.api.runner.assets.AssetManagerRegistry;
import ai.langstream.api.runner.topics.TopicConnectionsRuntimeRegistry;
import ai.langstream.api.runtime.ClusterRuntimeRegistry;
import ai.langstream.api.runtime.DeployContext;
import ai.langstream.api.runtime.ExecutionPlan;
import ai.langstream.api.runtime.PluginsRegistry;
import ai.langstream.impl.deploy.ApplicationDeployer;
Expand Down Expand Up @@ -124,6 +125,7 @@ private ApplicationDeployer buildDeployer(
.pluginsRegistry(new PluginsRegistry())
.topicConnectionsRuntimeRegistry(topicConnectionsRuntimeRegistry)
.assetManagerRegistry(assetManagerRegistry)
.deployContext(DeployContext.NO_DEPLOY_CONTEXT)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public void delete(
ApplicationDeployer.builder()
.registry(new ClusterRuntimeRegistry(clusterRuntimeConfiguration))
.pluginsRegistry(new PluginsRegistry())
.deployContext(DeployContext.NO_DEPLOY_CONTEXT)
.build()) {

log.info("Deleting application {}", applicationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import ai.langstream.api.runner.assets.AssetManagerRegistry;
import ai.langstream.api.runner.code.MetricsReporter;
import ai.langstream.api.runner.topics.TopicConnectionsRuntimeRegistry;
import ai.langstream.api.runtime.AgentNode;
import ai.langstream.api.runtime.ClusterRuntimeRegistry;
import ai.langstream.api.runtime.ExecutionPlan;
import ai.langstream.api.runtime.PluginsRegistry;
import ai.langstream.api.runtime.*;
import ai.langstream.deployer.k8s.agents.AgentResourcesFactory;
import ai.langstream.impl.deploy.ApplicationDeployer;
import ai.langstream.impl.nar.NarFileHandler;
Expand Down Expand Up @@ -101,6 +98,7 @@ public LocalApplicationRunner(
.pluginsRegistry(new PluginsRegistry())
.topicConnectionsRuntimeRegistry(topicConnectionsRuntimeRegistry)
.assetManagerRegistry(assetManagerRegistry)
.deployContext(DeployContext.NO_DEPLOY_CONTEXT)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
import ai.langstream.api.model.StoredApplication;
import ai.langstream.api.model.TopicDefinition;
import ai.langstream.api.runner.topics.TopicConnectionsRuntimeRegistry;
import ai.langstream.api.runtime.AgentNode;
import ai.langstream.api.runtime.ClusterRuntimeRegistry;
import ai.langstream.api.runtime.ExecutionPlan;
import ai.langstream.api.runtime.PluginsRegistry;
import ai.langstream.api.runtime.Topic;
import ai.langstream.api.runtime.*;
import ai.langstream.api.storage.ApplicationStore;
import ai.langstream.api.webservice.tenant.TenantConfiguration;
import ai.langstream.impl.common.DefaultAgentNode;
Expand Down Expand Up @@ -57,6 +53,7 @@ public class ApplicationService {
.registry(new ClusterRuntimeRegistry())
.pluginsRegistry(new PluginsRegistry())
.topicConnectionsRuntimeRegistry(new TopicConnectionsRuntimeRegistry())
.deployContext(DeployContext.NO_DEPLOY_CONTEXT)
.build();

private final GlobalMetadataService globalMetadataService;
Expand Down

0 comments on commit 4deeca9

Please sign in to comment.