-
Notifications
You must be signed in to change notification settings - Fork 95
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
[NU-1904] Add possiblity to configure deployment parameters for Eager… #7586
base: staging
Are you sure you want to change the base?
Changes from all commits
ea4a6eb
5e2cf31
917c0dd
2f476b9
893f358
706f76d
68934bb
6a458ea
97d4e46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package pl.touk.nussknacker.engine.api.process | ||
|
||
import pl.touk.nussknacker.engine.api.component.NodesDeploymentData.NodeDeploymentData | ||
import pl.touk.nussknacker.engine.api.process.ComponentUseContext.EngineRuntime | ||
|
||
/** | ||
* Specifies the mode a node is used/invoked. It can be one of the following values: | ||
* <ul> | ||
* <li>EngineRuntime - component is invoked in real engine, eg. Flink.</li> | ||
* <li>TestRuntime - component is invoked in test mode to collect results for test data. Can be used to stub real implementation.</li> | ||
* <li>Validation - used when compiling and validating nodes by Designer. Components should not be invoked in this mode.</li> | ||
* <li>ServiceQuery - used when component (Service) is invoked by Designer in ServiceQuery.</li> | ||
* <li>TestDataGeneration - used when compiling, but only for purpose of generating test data. Components should not be invoked in this mode.</li> | ||
* </ul> | ||
*/ | ||
sealed trait ComponentUseContext { | ||
|
||
def deploymentData(): Option[NodeDeploymentData] = this match { | ||
case EngineRuntime(nodeData) => nodeData | ||
case _ => None | ||
} | ||
|
||
} | ||
|
||
object ComponentUseContext { | ||
case class EngineRuntime(nodeData: Option[NodeDeploymentData]) extends ComponentUseContext | ||
case object TestRuntime extends ComponentUseContext | ||
case object Validation extends ComponentUseContext | ||
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. Can you remove contexts:
Also, I would rename two other contexts:
|
||
case object ServiceQuery extends ComponentUseContext | ||
case object TestDataGeneration extends ComponentUseContext | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import org.scalatest.matchers.should.Matchers | |
import org.scalatest.{BeforeAndAfterAll, Outcome} | ||
import pl.touk.nussknacker.engine.api._ | ||
import pl.touk.nussknacker.engine.api.parameter.ParameterName | ||
import pl.touk.nussknacker.engine.api.process.ComponentUseCase | ||
import pl.touk.nussknacker.engine.api.process.ComponentUseContext | ||
import pl.touk.nussknacker.engine.api.test.EmptyInvocationCollector.Instance | ||
import pl.touk.nussknacker.engine.api.typed.TypedMap | ||
import pl.touk.nussknacker.engine.util.ResourceLoader | ||
|
@@ -17,7 +17,7 @@ import pl.touk.nussknacker.engine.util.service.EagerServiceWithStaticParametersA | |
import pl.touk.nussknacker.http.backend.FixedAsyncHttpClientBackendProvider | ||
import pl.touk.nussknacker.openapi.enrichers.{SwaggerEnricherCreator, SwaggerEnrichers} | ||
import pl.touk.nussknacker.openapi.parser.SwaggerParser | ||
import pl.touk.nussknacker.openapi.{ApiKeySecret, OpenAPIServicesConfig, SecurityConfig, SecuritySchemeName} | ||
import pl.touk.nussknacker.openapi.{ApiKeySecret, OpenAPIServicesConfig, SecuritySchemeName} | ||
import pl.touk.nussknacker.test.PatientScalaFutures | ||
|
||
import java.net.URL | ||
|
@@ -31,9 +31,9 @@ class OpenAPIServiceSpec | |
with LazyLogging | ||
with PatientScalaFutures { | ||
|
||
implicit val componentUseCase: ComponentUseCase = ComponentUseCase.EngineRuntime | ||
implicit val metaData: MetaData = MetaData("testProc", StreamMetaData()) | ||
implicit val context: Context = Context("testContextId", Map.empty) | ||
implicit val componentUseCase: ComponentUseContext = ComponentUseContext.EngineRuntime(None) | ||
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. Rename componentUseCase to componentUseContext |
||
implicit val metaData: MetaData = MetaData("testProc", StreamMetaData()) | ||
implicit val context: Context = Context("testContextId", Map.empty) | ||
val jobData = JobData(metaData, ProcessVersion.empty.copy(processName = metaData.name)) | ||
|
||
type FixtureParam = EagerServiceWithStaticParametersAndReturnType | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use explicit cases matching. Thanks to that, we avoid some mistakes during changes around these contexts. Also, why not a normal polymorphism? I mean
def deploymentData