Hi all
We are developing an optimization script in Python while having some resources limitation, so we don’t have a resource to host this optimization service.
Is there a way to host this python script as a flow service at the integration server?
Hi all
We are developing an optimization script in Python while having some resources limitation, so we don’t have a resource to host this optimization service.
Is there a way to host this python script as a flow service at the integration server?
You can’t run it inside java, but you could call it via a java service e.g.
String run = "cmd /c python duplicatetestingoriginal.py" ;
boolean isCreated = fwr.writeFile(BugFile, GD, 500, true, 5, "LET");
if(isCreated){
try{
r = Runtime.getRuntime();
p = r.exec(run);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String line = "";
while ((line = stdInput.readLine()) != null) {
System.out.println(line);
}
while ((line = stdError.readLine()) != null) {
errorW.write(line);
}
int exitVal = p.waitFor();
arrayList = fwr.readResults();
}catch(Exception e){
}
}
else{
// troubleshoot....
}
or you could try rewriting it into a java service e.g.
Out of curiocity - what usecase are you trying to solve?
We have a BPM implementation.
In one of the processes we need to do some optimization logic, which we developed a python script to do and wanted to host this python script as a flow service.
A question.
Would it make sense to create an API in Python that runs the script based on input and returns output? It would need to run as a separate process and then invoke the API over HTTP/S from IS/BPM.
Compared to embeding it into the code you may find API approahc more elegent. Plus API code can be updated without having to change BPM.
It may take you more effort upfront, but will keep solution flexible.
Exactly,
This is what we are doing currently, but we were trying to host it within IS as we have some infrastructure resources limitations and didn’t prefer to run other applications on the same machine hosting the IS
Best regards,
Mohammed Alshehri
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.