Skip to content

Commit

Permalink
Merge branch 'staging' into counts-popover
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianWielga authored Sep 27, 2024
2 parents 63f3423 + a2e3279 commit 0e0f19e
Show file tree
Hide file tree
Showing 424 changed files with 20,559 additions and 3,220 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ jobs:
if-no-files-found: ignore
- name: Create Pull Request
id: update_snapshots
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v7
if: always() && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
env:
HASH: ${{ format('#{0}', github.event.number) }}
Expand Down
6 changes: 3 additions & 3 deletions .run/NussknackerApp-postgres.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<env name="USAGE_REPORTS_FINGERPRINT" value="development" />
<env name="USAGE_REPORTS_SOURCE" value="sources" />
<env name="INPUT_CONFIG_RESOLVE_ENV_VARIABLES" value="false" />
<env name="DB_URL" value="jdbc:postgresql://localhost:5432/world-db" />
<env name="DB_URL" value="jdbc:postgresql://localhost:5432/nu-db" />
<env name="DB_DRIVER" value="org.postgresql.Driver" />
<env name="DB_USER" value="world" />
<env name="DB_PASSWORD" value="world123" />
<env name="DB_USER" value="nu" />
<env name="DB_PASSWORD" value="nupassword" />
<env name="TABLES_DEFINITION_FILE" value="../../../nussknacker-dist/src/universal/conf/dev-tables-definition.sql" />
</envs>
<option name="INCLUDE_PROVIDED_SCOPE" value="true" />
Expand Down
15 changes: 15 additions & 0 deletions .run/RunEnvForLocalDesigner.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="RunEnvForLocalDesigner" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="pl.touk.nussknacker.dev.RunEnvForLocalDesigner" />
<module name="nussknacker-designer" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="pl.touk.nussknacker.dev.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
14 changes: 12 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,18 @@ Changing the version of the Scala is done by setting `NUSSKNACKER_SCALA_VERSION`
#### Running using integration environment
- Clone [nussknacker-quickstart](https://github.com/TouK/nussknacker-quickstart/tree/old-quickstart)
- Run `docker-compose -f docker-compose-env.yml -f docker-compose-custom.yml up -d` inside it
Use one of the following method:
1. run using SBT: `sbt designer/test:"runMain pl.touk.nussknacker.dev.RunEnvForLocalDesigner"`
2. run using Intellij configuration: `RunEnvForLocalDesigner`
3. run Docker Compose: `docker compose -f examples/dev/local-testing.docker-compose.yml -f examples/dev/nu-scala213.override.yml up -d`
You can also customize the setup by adding your changes in separate yaml file:
* like this: `sbt designer/test:"runMain pl.touk.nussknacker.dev.RunEnvForLocalDesigner --customizeYaml=/tmp/my.override.yml"`
* or this: `docker compose -f examples/dev/local-testing.docker-compose.yml -f examples/dev/nu-scala213.override.yml -f /tmp/my.override.yml up -d`
By default, an environment for Scala 2.13 is prepared. To run one for Scala 2.12:
* run: `sbt designer/test:"runMain pl.touk.nussknacker.dev.RunEnvForLocalDesigner --scalaV scala212"`
* or run: `docker compose -f examples/dev/local-testing.docker-compose.yml up -d`
#### Running Designer with model classes on the same classes as designer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,20 @@ class InterpreterSetup[T: ClassTag] {
process: CanonicalProcess,
additionalComponents: List[ComponentDefinition]
): (Context, ServiceExecutionContext) => F[List[Either[InterpretationResult, NuExceptionInfo[_ <: Throwable]]]] = {
val compilerData = prepareCompilerData(additionalComponents)
val jobData = JobData(process.metaData, ProcessVersion.empty.copy(processName = process.metaData.name))
val compilerData = prepareCompilerData(jobData, additionalComponents)
val interpreter = compilerData.interpreter
val parts = failOnErrors(compilerData.compile(process))

def compileNode(part: ProcessPart) =
failOnErrors(compilerData.subPartCompiler.compile(part.node, part.validationContext)(process.metaData).result)
failOnErrors(compilerData.subPartCompiler.compile(part.node, part.validationContext)(jobData).result)

val compiled = compileNode(parts.sources.head)
(initialCtx: Context, ec: ServiceExecutionContext) =>
interpreter.interpret[F](compiled, process.metaData, initialCtx, ec)
(initialCtx: Context, ec: ServiceExecutionContext) => interpreter.interpret[F](compiled, jobData, initialCtx, ec)
}

def prepareCompilerData(
jobData: JobData,
additionalComponents: List[ComponentDefinition],
): ProcessCompilerData = {
val components = List(
Expand All @@ -59,6 +60,7 @@ class InterpreterSetup[T: ClassTag] {
val definitionsWithTypes = ModelDefinitionWithClasses(definitions)

ProcessCompilerData.prepare(
jobData,
definitionsWithTypes,
new SimpleDictRegistry(Map.empty).toEngineRegistry,
List.empty,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package pl.touk.nussknacker.engine.benchmarks.serialization

import java.io.{ByteArrayInputStream, ByteArrayOutputStream}
import com.github.ghik.silencer.silent

import java.io.{ByteArrayInputStream, ByteArrayOutputStream}
import com.typesafe.scalalogging.LazyLogging
import org.apache.flink.api.common.ExecutionConfig
import org.apache.flink.api.common.typeinfo.TypeInformation
Expand All @@ -21,6 +22,7 @@ class SerializationBenchmarkSetup[T](

private val data = new ByteArrayOutputStream(10 * 1024)

@silent("deprecated")
private val serializer = typeInfo.createSerializer(config)

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package pl.touk.nussknacker.engine.benchmarks.serialization.avro

import com.typesafe.config.ConfigFactory
import org.apache.avro.generic.GenericData
import org.apache.flink.api.common.ExecutionConfig
import org.apache.flink.api.common.typeinfo.TypeInformation
import org.openjdk.jmh.annotations._
import pl.touk.nussknacker.engine.benchmarks.serialization.SerializationBenchmarkSetup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import pl.touk.nussknacker.engine.api.context.ValidationContext
import pl.touk.nussknacker.engine.api.typed.typing.{Typed, Unknown}
import pl.touk.nussknacker.engine.api.{Context, NodeId}
import pl.touk.nussknacker.engine.compile.ExpressionCompiler
import pl.touk.nussknacker.engine.definition.clazz.ClassDefinitionSet
import pl.touk.nussknacker.engine.definition.clazz.ClassDefinitionTestUtils
import pl.touk.nussknacker.engine.dict.SimpleDictRegistry
import pl.touk.nussknacker.engine.expression.ExpressionEvaluator
import pl.touk.nussknacker.engine.graph.expression.Expression
Expand All @@ -27,7 +27,7 @@ class SpelBenchmarkSetup(expression: String, vars: Map[String, AnyRef]) {
getClass.getClassLoader,
new SimpleDictRegistry(Map.empty),
expressionConfig,
classDefinitionSet = ClassDefinitionSet.forDefaultAdditionalClasses,
classDefinitionSet = ClassDefinitionTestUtils.createDefinitionForDefaultAdditionalClasses,
evaluator
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import pl.touk.nussknacker.engine.api.context.ValidationContext
import pl.touk.nussknacker.engine.api.typed.typing.{Typed, Unknown}
import pl.touk.nussknacker.engine.api.{Context, NodeId}
import pl.touk.nussknacker.engine.compile.ExpressionCompiler
import pl.touk.nussknacker.engine.definition.clazz.ClassDefinitionSet
import pl.touk.nussknacker.engine.definition.clazz.ClassDefinitionTestUtils
import pl.touk.nussknacker.engine.dict.SimpleDictRegistry
import pl.touk.nussknacker.engine.expression.ExpressionEvaluator
import pl.touk.nussknacker.engine.graph.expression.Expression
Expand All @@ -24,7 +24,7 @@ class SpelSecurityBenchmarkSetup(expression: String, vars: Map[String, AnyRef])
getClass.getClassLoader,
new SimpleDictRegistry(Map.empty),
expressionDefinition,
classDefinitionSet = ClassDefinitionSet.forDefaultAdditionalClasses,
classDefinitionSet = ClassDefinitionTestUtils.createDefinitionForDefaultAdditionalClasses,
evaluator
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
package pl.touk.nussknacker.engine.benchmarks.suggester

import pl.touk.nussknacker.engine.api.dict.embedded.EmbeddedDictDefinition
import pl.touk.nussknacker.engine.api.process.ClassExtractionSettings
import pl.touk.nussknacker.engine.dict.{SimpleDictQueryService, SimpleDictRegistry}
import pl.touk.nussknacker.ui.suggester.ExpressionSuggester
import pl.touk.nussknacker.engine.testing.ModelDefinitionBuilder
import pl.touk.nussknacker.engine.api.dict.UiDictServices
import pl.touk.nussknacker.engine.api.dict.embedded.EmbeddedDictDefinition
import pl.touk.nussknacker.engine.api.typed.typing.{Typed, TypingResult}
import pl.touk.nussknacker.engine.definition.clazz.{ClassDefinitionExtractor, ClassDefinitionSet}
import pl.touk.nussknacker.engine.definition.clazz.{ClassDefinitionSet, ClassDefinitionTestUtils}
import pl.touk.nussknacker.engine.dict.{SimpleDictQueryService, SimpleDictRegistry}
import pl.touk.nussknacker.engine.graph.expression.Expression
import pl.touk.nussknacker.engine.graph.expression.Expression.Language
import pl.touk.nussknacker.engine.testing.ModelDefinitionBuilder
import pl.touk.nussknacker.engine.util.CaretPosition2d
import pl.touk.nussknacker.ui.suggester.ExpressionSuggester

import java.time.{Duration, LocalDateTime}
import scala.concurrent.duration.{Duration => ScalaDuration}
import scala.concurrent.{Await, ExecutionContext}

/* This is helper class for testing SpEL expressions, see SampleSpelBenchmark for usage */
class ExpressionSuggesterBenchmarkSetup() {

implicit val classExtractionSettings: ClassExtractionSettings = ClassExtractionSettings.Default
private val classDefinitionExtractor = ClassDefinitionTestUtils.DefaultExtractor

private val dictRegistry = new SimpleDictRegistry(
Map(
Expand All @@ -32,11 +30,11 @@ class ExpressionSuggesterBenchmarkSetup() {

private val clazzDefinitions: ClassDefinitionSet = ClassDefinitionSet(
Set(
ClassDefinitionExtractor.extract(classOf[Foo]),
ClassDefinitionExtractor.extract(classOf[Bar]),
ClassDefinitionExtractor.extract(classOf[String]),
ClassDefinitionExtractor.extract(classOf[LocalDateTime]),
ClassDefinitionExtractor.extract(classOf[Duration]),
classDefinitionExtractor.extract(classOf[Foo]),
classDefinitionExtractor.extract(classOf[Bar]),
classDefinitionExtractor.extract(classOf[String]),
classDefinitionExtractor.extract(classOf[LocalDateTime]),
classDefinitionExtractor.extract(classOf[Duration]),
)
)

Expand Down
Loading

0 comments on commit 0e0f19e

Please sign in to comment.