Python在SLURM中对nodejs进行系统调用,但无法从node.js获取输出

时间:2017-05-03 23:22:06

标签: python node.js slurm

我有一个python代码,当我从控制台运行时可以工作。

python hello.py; #returns hello.

但是当我在SLURM中运行我的python代码时,nodejs代码不会返回任何输出。我看到一个空字符串['']

hello.py

def contractCall( val ):
   return os.popen( val + "| sudo nodejs").read().replace("\n", "").replace(" ", "");

jobInfo = contractCall('echo "console.log( \'hello\'   )"');
print(jobInfo); #this line returns [''] when I call it inside SLURM.

slurmRun.sh

#!/bin/bash
#SBATCH -o slurm.out        # STDOUT
#SBATCH -e slurm.err        # STDERR

python hello.py 

其输出:['']

感谢您宝贵的时间和帮助。

0 个答案:

没有答案