Skip to content

Commit

Permalink
Subprocess -> fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
mproch committed Jul 15, 2021
1 parent 933dc91 commit 52c8523
Show file tree
Hide file tree
Showing 50 changed files with 117 additions and 109 deletions.
1 change: 1 addition & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Nussknacker versions
* [#1357](https://github.com/TouK/nussknacker/pull/1357) Add run mode to nodes to be able to determine if we are inside e.g. test process run.
Run mode is can be declared as a dependency in generic node transformations. Nodes created via `@MethodToInvoke` can declare `RunMode` as an implicit parameter.
`RunMode` is also available in `FlinkCustomNodeContext`.
* [#1911](https://github.com/TouK/nussknacker/pull/1911) Rename `process` to `scenario`, `subprocess` to `fragment` in messages at backend and some test cases names

0.3.1 (not released yet)
------------------------
Expand Down
7 changes: 7 additions & 0 deletions docs/components/ComponentConfiguration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Component configuration
=======================

```
```

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ sealed trait CustomActionError extends Exception {
case class CustomActionFailure(request: CustomActionRequest, msg: String) extends CustomActionError

case class CustomActionInvalidStatus(request: CustomActionRequest, stateStatusName: String) extends CustomActionError {
override val msg: String = s"Process status: $stateStatusName is not allowed for action ${request.name}"
override val msg: String = s"Scenario status: $stateStatusName is not allowed for action ${request.name}"
}

case class CustomActionNotImplemented(request: CustomActionRequest) extends CustomActionError {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,21 @@ object SimpleProcessStateDefinitionManager extends ProcessStateDefinitionManager
statusDescriptionsMap.get(stateStatus)

def shouldBeRunningTooltip(deployedVersionId: Long, user: String): String =
s"Process deployed in version ${deployedVersionId} (by ${user}), should be running!"
s"Scenario deployed in version ${deployedVersionId} (by ${user}), should be running!"

def mismatchDeployedVersionTooltip(deployedVersionId: Long, exceptedVersionId: Long, user: String): String =
s"Process deployed in version ${deployedVersionId} (by ${user}), expected version ${exceptedVersionId}!"
s"Scenario deployed in version ${deployedVersionId} (by ${user}), expected version ${exceptedVersionId}!"

def missingDeployedVersionTooltip(exceptedVersionId: Long, user: String): String =
s"Process deployed without version (by ${user}), expected version ${exceptedVersionId}!"
s"Scenario deployed without version (by ${user}), expected version ${exceptedVersionId}!"

val shouldBeRunningDescription: String = "Process currently is not running!"
val shouldBeRunningDescription: String = "Scenario currently is not running!"

val mismatchDeployedVersionDescription: String = "Deployed scenario mismatch version!"

val missingDeployedVersionDescription: String = "Missing version of deployed scenario!"

val processWithoutActionMessage: String = "Process state error - no actions found!"
val processWithoutActionMessage: String = "Scenario state error - no actions found!"

val deployFailedIcon: URI = URI.create("/assets/states/deploy-failed.svg")

Expand All @@ -114,8 +114,8 @@ object SimpleProcessStateDefinitionManager extends ProcessStateDefinitionManager
val notDeployedWarningIcon: URI = URI.create("/assets/states/not-deployed-warning.svg")

def shouldNotBeRunningMessage(deployed: Boolean): String =
if (deployed) "Process has been canceled but still is running!"
else "Process has been never deployed but now is running!"
if (deployed) "Scenario has been canceled but still is running!"
else "Scenario has been never deployed but now is running!"

def shouldNotBeRunningIcon(deployed: Boolean): URI =
if (deployed) stoppingWarningIcon else notDeployedWarningIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class PeriodicProcessManager(val delegate: ProcessManager,
.map(_.isDefined)
.flatMap(shouldStop => {
if (shouldStop) {
logger.info(s"Process ${processVersion.processName} is running or scheduled. Cancelling before reschedule")
logger.info(s"Scenario ${processVersion.processName} is running or scheduled. Cancelling before reschedule")
cancel(processVersion.processName, user).map(_ => ())
}
else Future.successful(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ class PeriodicProcessService(delegateProcessManager: ProcessManager,
} yield externalDeploymentId
deploymentAction
.flatMap { externalDeploymentId =>
logger.info("Process has been deployed {} for deployment id {}", deploymentWithJarData.processVersion, id)
logger.info("Scenario has been deployed {} for deployment id {}", deploymentWithJarData.processVersion, id)
//TODO: add externalDeploymentId??
scheduledProcessesRepository.markDeployed(id)
.flatMap(_ => scheduledProcessesRepository.findProcessData(id))
.flatMap(afterChange => handleEvent(DeployedEvent(afterChange, externalDeploymentId))).run
}
// We can recover since deployment actor watches only future completion.
.recoverWith { case exception =>
logger.error(s"Process deployment ${deployment.display} failed", exception)
logger.error(s"Scenario deployment ${deployment.display} failed", exception)
markFailedAction(deployment, None).run
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object SchedulePropertyExtractor {
processDeploymentData match {
case GraphProcess(processAsJson) =>
for {
canonicalProcess <- ProcessMarshaller.fromJson(processAsJson).leftMap(_ => "Process is unparseable").toEither.right
canonicalProcess <- ProcessMarshaller.fromJson(processAsJson).leftMap(_ => "Scenario is unparseable").toEither.right
property <- canonicalProcess.metaData.additionalFields.flatMap(_.properties.get(name)).toRight(s"$name property is missing").right
} yield property
case CustomProcess(_) => Left("Custom scenario is not supported")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CronSchedulePropertyExtractorTest extends FunSuite
test("should fail for unparseable scenario json") {
val result = extractor(GraphProcess("broken"))

inside(result) { case Left("Process is unparseable") => }
inside(result) { case Left("Scenario is unparseable") => }
}

test("should fail for missing cron property") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ object FlinkProcessStateDefinitionManager extends ProcessStateDefinitionManager
)

val statusTooltipsMap: Map[StateStatus, String] = Map(
FlinkStateStatus.Restarting -> "Process was deployed but now is restarting..."
FlinkStateStatus.Restarting -> "Scenario was deployed but now is restarting..."
)

val statusDescriptionsMap: Map[StateStatus, String] = Map(
FlinkStateStatus.Restarting -> "Process is restarting..."
FlinkStateStatus.Restarting -> "Scenario is restarting..."
)

override def statusTooltip(stateStatus: StateStatus): Option[String] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class FlinkProcessRegistrar(compileProcess: (EspProcess, ProcessVersion, Deploym
Map()

case part: SinkPart =>
throw new IllegalArgumentException(s"Process can only use flink sinks, instead given: ${part.obj}")
throw new IllegalArgumentException(s"Scenario can only use flink sinks, instead given: ${part.obj}")
case part@CustomNodePart(transformerObj, node, contextBefore, contextAfter, _, _) =>

val transformer = transformerObj match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ trait FlinkProcessMain[Env] extends FlinkRunner with LazyLogging {
try {
val args = FlinkArgsDecodeHack.prepareProgramArgs(argsWithHack)

require(args.nonEmpty, "Process json should be passed as a first argument")
require(args.nonEmpty, "Scenario json should be passed as a first argument")
val process = readProcessFromArg(args(0))
val processVersion = parseProcessVersion(args(1))
val deploymentData = parseDeploymentData(args(2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SubprocessSpec extends FunSuite with Matchers with ProcessTestHelpers {

import pl.touk.nussknacker.engine.spel.Implicits._

test("should accept same id in subprocess and main process ") {
test("should accept same id in fragment and main process ") {

val process = resolve(EspProcessBuilder.id("proc1")
.exceptionHandler()
Expand All @@ -39,7 +39,7 @@ class SubprocessSpec extends FunSuite with Matchers with ProcessTestHelpers {
MockService.data.head shouldBe "a"
}

test("should handle split in subprocess") {
test("should handle split in fragment") {

val process = resolve(EspProcessBuilder.id("proc1")
.exceptionHandler()
Expand All @@ -57,7 +57,7 @@ class SubprocessSpec extends FunSuite with Matchers with ProcessTestHelpers {
MockService.data.head shouldBe "a"
}

test("be possible to use global vars in subprocess") {
test("be possible to use global vars in fragment") {
val process = resolve(EspProcessBuilder.id("proc1")
.exceptionHandler()
.source("id", "input")
Expand All @@ -74,7 +74,7 @@ class SubprocessSpec extends FunSuite with Matchers with ProcessTestHelpers {
MockService.data.head shouldBe "a"
}

test("be possible to use diamond subprocesses") {
test("be possible to use diamond fragments") {
val process = resolve(EspProcessBuilder.id("proc1")
.exceptionHandler()
.source("id", "input")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class InterpreterSpec extends FunSuite with Matchers {

}

test("handle subprocess") {
test("handle fragment") {
val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
.source("source", "transaction-source")
Expand All @@ -398,7 +398,7 @@ class InterpreterSpec extends FunSuite with Matchers {
interpretProcess(resolved, Transaction(accountId = "a"), List()) shouldBe "result"
}

test("handle subprocess with two occurrences") {
test("handle fragment with two occurrences") {
val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
.source("source", "transaction-source")
Expand Down Expand Up @@ -427,7 +427,7 @@ class InterpreterSpec extends FunSuite with Matchers {
}


test("handle nested subprocess") {
test("handle nested fragment") {
val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
.source("source", "transaction-source")
Expand Down Expand Up @@ -457,7 +457,7 @@ class InterpreterSpec extends FunSuite with Matchers {
interpretProcess(resolved, Transaction(accountId = "a"), List()) shouldBe "result"
}

test("handle subprocess with more than one output") {
test("handle fragment with more than one output") {
val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
.source("source", "transaction-source")
Expand All @@ -484,7 +484,7 @@ class InterpreterSpec extends FunSuite with Matchers {
interpretProcess(resolved, Transaction(accountId = "b"), List()) shouldBe "result2"
}

test("handle subprocess at end") {
test("handle fragment at end") {
val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
.source("source", "transaction-source")
Expand All @@ -503,7 +503,7 @@ class InterpreterSpec extends FunSuite with Matchers {
interpretProcess(resolved, Transaction(accountId = "a"), List()) shouldBe "result"
}

test("interprets subprocess output fields") {
test("interprets fragment output fields") {
val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
.source("source", "transaction-source")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ class CanonicalProcessTest extends FunSuite with Matchers {
withNodesEnabled.withoutDisabledNodes shouldBe withNodesEnabled
}

test("#withoutDisabledNodes with disabled subprocess") {
test("#withoutDisabledNodes with disabled fragment") {
val withDisabledSubprocess = process(
List(source1, subprocess(List(sink1), isDisabled = true)))

withDisabledSubprocess.withoutDisabledNodes shouldBe process(List(source1, sink1))
}

test("#withoutDisabledNodes with subprocess with disabled subprocess") {
test("#withoutDisabledNodes with fragment with disabled fragment") {
val withSubprocessWithDisabledSubprocess = process(
List(
source1,
Expand All @@ -76,7 +76,7 @@ class CanonicalProcessTest extends FunSuite with Matchers {
)
}

test("#withoutDisabledNodes with disabled subprocess with disabled subprocess") {
test("#withoutDisabledNodes with disabled fragment with disabled fragment") {
val withDisabledSubprocessWithDisabledSubprocess = process(
List(
source1,
Expand Down Expand Up @@ -135,7 +135,7 @@ class CanonicalProcessTest extends FunSuite with Matchers {
)
}

test("#withoutDisabledNodes with split with subprocess with disabled subprocess") {
test("#withoutDisabledNodes with split with fragment with disabled fragment") {
process(
List(
source1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class NodeDataValidatorSpec extends FunSuite with Matchers with Inside {
}
}

ignore("should validate subprocess") {
ignore("should validate fragment") {
//TODO
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ class ProcessValidatorSpec extends FunSuite with Matchers with Inside {



test("not validate exception handler params in subprocess") {
test("not validate exception handler params in fragment") {

val subprocess = CanonicalProcess(MetaData("subProcess1", StreamMetaData(), true), ExceptionHandlerRef(List()),
List(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SubprocessResolverSpec extends FunSuite with Matchers with Inside{

}

test("resolve nested subprocesses") {
test("resolve nested fragments") {

val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
Expand Down Expand Up @@ -92,7 +92,7 @@ class SubprocessResolverSpec extends FunSuite with Matchers with Inside{
resolved.nodes.find(_.id == "sub-sub2-f1") shouldBe 'defined
}

test("not resolve subprocess with missing parameters") {
test("not resolve fragment with missing parameters") {

val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
Expand All @@ -112,7 +112,7 @@ class SubprocessResolverSpec extends FunSuite with Matchers with Inside{

}

test("not resolve subprocess with bad outputs") {
test("not resolve fragment with bad outputs") {

val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
Expand All @@ -133,7 +133,7 @@ class SubprocessResolverSpec extends FunSuite with Matchers with Inside{

}

test("not disable subprocess with many outputs") {
test("not disable fragment with many outputs") {

val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
Expand Down Expand Up @@ -163,7 +163,7 @@ class SubprocessResolverSpec extends FunSuite with Matchers with Inside{
resolvedValidated shouldBe Invalid(NonEmptyList.of(DisablingManyOutputsSubprocess("sub", Set("output1", "output2"))))

}
test("not disable subprocess with no outputs") {
test("not disable fragment with no outputs") {

val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
Expand All @@ -186,7 +186,7 @@ class SubprocessResolverSpec extends FunSuite with Matchers with Inside{

}

test("inline disabled subprocess without inner nodes") {
test("inline disabled fragment without inner nodes") {
val processWithEmptySubprocess = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
.source("source", "source1")
Expand Down Expand Up @@ -252,7 +252,7 @@ class SubprocessResolverSpec extends FunSuite with Matchers with Inside{
inside(resolver.resolve(processWithDisabledSubprocess))(pattern)
}

test("resolve subprocess at end of process") {
test("resolve fragment at end of process") {
val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
.source("source", "source1")
Expand All @@ -273,7 +273,7 @@ class SubprocessResolverSpec extends FunSuite with Matchers with Inside{
resolved.nodes.filter(_.isInstanceOf[Subprocess]) shouldBe 'empty
}

test("detect unknown subprocess") {
test("detect unknown fragment") {
val process = ProcessCanonizer.canonize(EspProcessBuilder
.id("process1")
.exceptionHandler()
Expand All @@ -287,7 +287,7 @@ class SubprocessResolverSpec extends FunSuite with Matchers with Inside{
resolvedValidated shouldBe Invalid(NonEmptyList.of(UnknownSubprocess(id = "subProcessId", nodeId = "nodeSubprocessId")))
}

test("should resolve diamond subprocesses") {
test("should resolve diamond fragments") {
val process = ProcessCanonizer.canonize(EspProcessBuilder.id("test")
.exceptionHandler()
.source("source", "source1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class DeploymentService(context: StandaloneContextPreparer, modelData: ModelData
val currentAtPath = pathToInterpreterMap.get(pathToDeploy).map(_.id)
currentAtPath match {
case Some(oldId) if oldId != processName.value =>
Invalid(NonEmptyList.of(DeploymentError(Set(), s"Process $oldId is already deployed at path $pathToDeploy")))
Invalid(NonEmptyList.of(DeploymentError(Set(), s"Scenario $oldId is already deployed at path $pathToDeploy")))
case _ =>
val interpreter = newInterpreter(process)
interpreter.foreach { processInterpreter =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class AppResources(config: Config,
if (processes.isEmpty) {
createHealthCheckHttpResponse(OK)
} else {
createHealthCheckHttpResponse(ERROR, Some("Processes with validation errors"), Some(processes.toSet))
createHealthCheckHttpResponse(ERROR, Some("Scenarios with validation errors"), Some(processes.toSet))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class NotificationResources(managementActor: ActorRef,
case DeploymentActionType.Deployment => "deployed"
case DeploymentActionType.Cancel => "cancelled"
}
Notification(s"Process ${processName.value} is $actionString by ${deploymentInfo.userId}", NotificationType.info)
Notification(s"Scenario ${processName.value} is $actionString by ${deploymentInfo.userId}", NotificationType.info)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ProcessReportResources(countsReporter: CountsReporter, processCounter: Pro
case Some(displayable) => computeCounts(displayable, request)
case None => Future.successful(HttpResponse(status = StatusCodes.NotFound, entity = "Counts unavailable for this scenario"))
}
case None => Future.successful(HttpResponse(status = StatusCodes.NotFound, entity = "Process not found"))
case None => Future.successful(HttpResponse(status = StatusCodes.NotFound, entity = "Scenario not found"))
}
}
}
Expand Down
Loading

0 comments on commit 52c8523

Please sign in to comment.