CALL instruction and WarpScript

47 views
Skip to first unread message

Andrew Student

unread,
Jul 4, 2018, 11:35:05 AM7/4/18
to Warp 10 users
Hi,

I'm getting some issues using the 'CALL' instruction into my wrapscript and didn't find much help.

For the moment, here is my WrapScript with the CALL instruction:

'/pythonScripts/testScript/wrapper.sh'

CALL


First, I get this error:

ERROR line #3: in section '[TOP]': Empty stack

So, first weird things, it look like my value is not detected as 'pushed on the stack'.

So I tried to push two time my value on the stack:

'/pythonScripts/testScript/wrapper.sh'
'/pythonScripts/testScript/wrapper.sh'

CALL

This time, I get another error, closest that what I've expected:

ERROR line #4: in section '[TOP]': CALL invalid subprogram '/pythonScripts/testScript/wrapper.sh'.

I've double checked, the patch are correct.

For the script itself, wrapper.sh is simply a wrapper to call my python script, as suggested here: https://github.com/cityzendata/warp10-platform/blob/master/warp10/src/main/python/callable.py

bash-4.3# cat /pythonScripts/testScript/wrapper.sh
#!/bin/sh

#
# This shellscript is a simple python script wrapper boilerplate
#

EXECDIR=${PWD}
BASEDIR=$(dirname $0)

# Setup a new virtualenv for the script
python3 -m venv $BASEDIR/venv
source $BASEDIR/venv/bin/activate

# Install all required script packages
# Can do:
# pip install -r requirements.txt
# Or manually:
pip install requests

python $BASEDIR/script.py



And for the script itself, It's really basic:

bash-4.3# cat /pythonScripts/testScript/script.py
import requests

# This script is a simple example, do not use it

response = requests.get('https://www.google.com/')

if response.status_code == 200:
    print("80027d71002858060000005049434b4c4571015806000000535452494e477102752e")



I didn't spot my error, hoping you can help me to find it :)

Mathias Herberts

unread,
Jul 4, 2018, 12:21:41 PM7/4/18
to Warp 10 users
Hi,

there are two errors un your use of CALL, first your script must conform to the bihavior described in https://github.com/cityzendata/warp10-platform/blob/master/warp10/src/main/python/callable.py, i.e. it must start by returning the maximum number of parallel instances to run, it must have unbuffered output and it must enter an endless loop.

The use of CALL expects the path to the script on top of the stack but also a single STRING to pass to the script as input.

Mathias Herberts

unread,
Jul 4, 2018, 12:23:08 PM7/4/18
to Warp 10 users
Also the path to your script must not contain the path to the script directory contained in Warp 10, only the parts after it.


On Wednesday, July 4, 2018 at 5:35:05 PM UTC+2, Andrew Student wrote:

Andrew Student

unread,
Jul 9, 2018, 5:10:55 AM7/9/18
to Warp 10 users
Thank you for your advice.

Indeed, with the proper format of script and the relative path from the 'calls' directory, it works :)
Reply all
Reply to author
Forward
0 new messages