Libcall

created on 2016-12-04 18:54:09

project

A small wrapper for different types of calls, it can be used to spawn and track a process or to just run python code from string onto a new thread with timeout support


Description

A small wrapper for different types of calls, it can be used to spawn and track a process or to just run python code from string onto a new thread with timeout support. This small lib adds logging and error handling in a way that can be useful for running in agents within a distributed system where you need a uniform yet flexible way to invoke different types of calls and possibly with timeouts. You will get a handle that you can use to retrieve the status of the running call or to order it to stop at any point in time always using the same API regardless of the call type.

Keep in mind this offers no Security, untrusted data should never reach any of these calls

Written for Python 2 but can easily be converted to 3

Status: highly experimental

Types of calls supported:

Example

1.
2.
3.
4.
5.
6.
7.
8.
 """
import time
while True:
time.sleep(0.1)
print 'end'
"""
d = call.Command(code,'python-basic', logger=logger, timeout=2)
d.start()

Please check the examples in the source code repository at here for more.

Requirements

Download

Check out the source code at github page:

git clone https://github.com/blackthorne/Libcall.git

Please check the github page here for more information and updates.

last modified on 2016-12-04 19:29:14