AegisBlade.com Python 2 & 3 client. Deploy & run any of your code in one function call.
Deploy & run your code in a single function call.
Read the docs »
Examples
·
Sign Up for an API Key
·
Report Bug
We recommend using virtualenv to create an isolated environment for your python application.
Install the python package as a dependency of your application.
$ pip install aegisblade
Or for python3
:
pip3 install aegisblade
import socket
from aegisblade import aegisblade
def helloworld():
"""
In this example we will deploy & run this function
inside of AegisBlade.
"""
hostname = socket.gethostname()
print("The server's hostname is {0}".format(hostname))
return "Hello World from {0}".format(hostname)
def main():
"""
The main() function will run on your local machine
and start a job on AegisBlade running the helloworld() function.
"""
# Calling aegisblade.run() will start the job on a server managed by AegisBlade.
# AegisBlade will handle provisioning hosts, deploying your code, and running it.
print("Creating Aegisblade job...")
job = aegisblade.run(lambda: helloworld())
# Return values are serialized and can be fetched when the job is finished.
#
# Calling .get_return_value() will wait for the job to finish,
# then get the return value.
print("Waiting for job to finish...")
job_return_value = job.get_return_value()
print("RETURN VALUE")
print(job_return_value)
# Logs are stored and can also be fetched after the job is finished.
job_logs = job.get_logs()
print("LOGS:")
print(job_logs)
# Using the __name__ == "__main__" idiom to only run main when this script
# is called directly is especially important when using AegisBlade.
#
# This script may be imported by the AegisBlade runtime, and without the
# protective check of __name__, main() would be called inside the job
# potentially causing an infinite loop of jobs starting more jobs.
if __name__ == "__main__":
main()
The official python organization will no longer support Python 2 following January 2020.
Due to it’s popular usage though, we will likely continue to support a Python 2.7 client for the forseeable future.
AegisBlade - @aegisbladehq - welovedevs@aegisblade.com
Project Link: https://github.com/aegisblade/aegis-python