Skip to content

Conversation

@fjtirado
Copy link
Collaborator

@fjtirado fjtirado commented Dec 2, 2025

Fix #936

Signed-off-by: fjtirado <ftirados@redhat.com>
@fjtirado fjtirado force-pushed the Fix_#936 branch 5 times, most recently from 7d74e17 to 78b8d96 Compare December 4, 2025 19:31
@fjtirado fjtirado marked this pull request as ready for review December 4, 2025 19:31
@fjtirado fjtirado force-pushed the Fix_#936 branch 2 times, most recently from 7ff3e23 to 8b57ec9 Compare December 4, 2025 20:03
private void addArg(List<String> list, String name, Object value) {
if (value instanceof Boolean bool) {
if (bool) {
list.add("--" + name);
Copy link
Collaborator Author

@fjtirado fjtirado Dec 4, 2025

Choose a reason for hiding this comment

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

Because of the way https://github.com/serverlessworkflow/catalog/blob/main/functions/log/1.0.0/function.yaml is implemented, params has to be prefixed with --
Notice that this impose restriction in other python scripts to be invoked, which has to follow the same structure.
Also this is assuming that, for boolean parameters, all python function will use store_true
This kind of conventions are one of the reasons why I feel we should change the spec to redefine scripts as calling embedded named parameters functions (which are supported both by JS and Python)

Signed-off-by: fjtirado <ftirados@redhat.com>
<module>container</module>
<module>test</module>
<module>script-js</module>
<module>python</module>
Copy link
Contributor

@mcruzdev mcruzdev Dec 5, 2025

Choose a reason for hiding this comment

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

Why not to follow script-python naming to follow an standard?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that probably js should have been called javascript

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great!

Copy link
Contributor

@mcruzdev mcruzdev left a comment

Choose a reason for hiding this comment

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

Looks great to me, I just left a comment about the module name.

WorkflowContext workflowContext,
TaskContext taskContext,
WorkflowModel model) {
ProcessBuilder builder = new ProcessBuilder("python", "-c", scriptContext.code());
Copy link
Contributor

Choose a reason for hiding this comment

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

It is just a question, why we are using a process instead a embedded python like we did in Javascript? I mean, what is the motivation?

Copy link
Collaborator Author

@fjtirado fjtirado Dec 9, 2025

Choose a reason for hiding this comment

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

It is implied as result of #1027 (comment)
The catalog function is forcing this to be invoked as external script.
I do not really like that and I think we need to dicuss on the CNCF forum, but right now we must implement this that way
Also, embedding python will require some intallation procedure in the target machine (the native library to be embedded needs to be compiled by python wheel first), while embedding Javascript is easier because the there are 100% java libraries doing that

@fjtirado fjtirado merged commit 098b99e into serverlessworkflow:main Dec 9, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Python

3 participants