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

[NU-1806] Add activity parameters #6860

Draft
wants to merge 2 commits into
base: staging
Choose a base branch
from
Draft

Conversation

gskrobisz
Copy link
Member

@gskrobisz gskrobisz commented Sep 13, 2024

Describe your changes

Zrzut ekranu z 2024-12-19 16-57-44

Checklist before merge

  • Related issue ID is placed at the beginning of PR title in [brackets] (can be GH issue or Nu Jira issue)
  • Code is cleaned from temporary changes and commented out lines
  • Parts of the code that are not easy to understand are documented in the code
  • Changes are covered by automated tests
  • Showcase in dev-application.conf added to demonstrate the feature
  • Documentation added or updated
  • Added entry in Changelog.md describing the change from the perspective of a public distribution user
  • Added MigrationGuide.md entry in the appropriate subcategory if introducing a breaking change
  • Verify that PR will be squashed during merge

Copy link
Contributor

github-actions bot commented Sep 13, 2024

updated: #6968
⚠️ Be careful! Snapshot changes are not necessarily the cause of the error. Check the logs.

@gskrobisz gskrobisz force-pushed the activity_capabilities branch 3 times, most recently from be0fe74 to e0b7858 Compare September 25, 2024 22:37
@github-actions github-actions bot added client client main fe ui labels Sep 25, 2024
@gskrobisz gskrobisz force-pushed the activity_capabilities branch from 8dd895f to 68932ac Compare October 1, 2024 12:36
@gskrobisz gskrobisz force-pushed the activity_capabilities branch 2 times, most recently from 214c008 to 6eb498d Compare December 17, 2024 22:56

object FixedExpressionValue {
val nullFixedValue: FixedExpressionValue = FixedExpressionValue("", "")
def apply(expression: String, label: String): FixedExpressionValue = FixedExpressionValue(expression, label, None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this apply method required? In code itself it is not required, because there is default value for hintText, but maybe I'm missing sth related to some integrations/Flink/Java.

// Raw deployment parameters (name -> value) that are used as additional node configuration during deployment.
// Each node can be provided with dedicated set of parameters.
// TODO: consider replacing NodeDeploymentData with Json
type NodeDeploymentData = Map[String, String]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be a final case class, serializable to JSON. Now it is a map, serializable to Json object. So adding any new field beside the map of raw params would break compatibility

implicit val fixedValuesParameterEditorEncoder: Encoder[FixedValuesParameterEditor] =
deriveEncoder[FixedValuesParameterEditor]

implicit val fixedValuesParameterEditorDecoder: Decoder[FixedValuesParameterEditor] = { (c: HCursor) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:

  implicit val fixedValuesParameterEditorDecoder: Decoder[FixedValuesParameterEditor] =
    Decoder.forProduct2("possibleValues", "mode")(FixedValuesParameterEditor.apply)
      .or(Decoder.forProduct1("possibleValues")(FixedValuesParameterEditor(_, FixedValuesEditorMode.LIST)))

* {"DEPLOY": { "parametername": ...parameter configuration... }
*/
trait WithActivityParameters { self: Source =>
def activityParametersDefinition: Map[String, Map[String, ParameterConfig]]
Copy link
Contributor

@mgoworko mgoworko Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be a good idea to define enum (sealed trait) with all possible scenario actions in the API module and make it the key of this map. Right now if we change the name of some scenario action, the change will not be enforceable by compiler in all implementations of this trait.

import pl.touk.nussknacker.ui.uiresolving.UIProcessResolver

// TODO: move to ActivityService? execute node compilation only once with ScenarioTestService?
class ActivityInfoService(activityInfoProvider: ActivityInfoProvider, processResolver: UIProcessResolver) {
Copy link
Contributor

@mgoworko mgoworko Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment about naming convention: I think that in this context the name "Scenario action" should be used. Deploy/cancel and others are scenario actions, not activities from what I know. It can be especially confusing now, when ScenarioActivities exist in different context.

with ProcessDirectives
with LazyLogging {

def securedRoute(implicit user: LoggedUser): Route = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed returning this information in the already existing endpoint /process/{name}/"status". I think that it would be a good idea, but I'm not sure if it would be easy or doable without making some POC. If not possible, then I think the new service should be a Tapir service, with "ActionInfo" in name instead of "ActivityInfo"

@gskrobisz gskrobisz force-pushed the activity_capabilities branch from 6eb498d to 62b2354 Compare December 20, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client main fe ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants