MattEnergy MattEnergy - 1 year ago 110
Python Question

Spring-XD fail to execute shell command

Python / SpringXD is not the combination resulting in the error written in my previous post, the shell of springxd alone can't succeed executing on my system

The stream definition:

trigger --cron='0 */1 * * * *' | shell --command='ls' | log

here is the error message:

2016-04-19T16:06:06-0400 1.3.1.SNAP ERROR inbound.awef-p2_7-log.0-redis:queue-inbound-channel-adapter1 redis.RedisMessageBus$1 - Failed to deliver message; retries exhausted; message sent to queue 'ERRORS:awef-p2_7-log.0' org.springframework.messaging.MessageHandlingException: nested exception is java.lang.RuntimeException: Stream closed
2016-04-19T16:06:17-0400 1.3.1.SNAP ERROR inbound.test-ls.0-redis:queue-inbound-channel-adapter1 process.ShellCommandProcessor - Stream closed Stream closed
at java.lang.ProcessBuilder$NullOutputStream.write( ~[na:1.8.0_66]
at ~[na:1.8.0_66]
at ~[na:1.8.0_66]
at ~[na:1.8.0_66]
at org.springframework.xd.extension.process.ShellCommandProcessor.send( [spring-xd-extension-process-1.3.1.BUILD-SNAPSHOT.jar!/:na]
at org.springframework.xd.extension.process.ShellCommandProcessor.sendAndReceive( [spring-xd-extension-process-1.3.1.BUILD-SNAPSHOT.jar!/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66]
at sun.reflect.NativeMethodAccessorImpl.invoke( ~[na:1.8.0_66]
at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[na:1.8.0_66]
at java.lang.reflect.Method.invoke( ~[na:1.8.0_66]

Answer Source

I finally twick the call to python through a groovy script:

stream def:

trigger --cron='0 0/1 * * * *' | script --script=file:/.../testjobpython.groovy | null

code groovy:

String[] pythonCmd = ["/usr/bin/python2.7","/.../"]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download