SlideShare a Scribd company logo
1 of 4
Download to read offline
Function-as-a-Service: A Pythonic Perspective
on Serverless Computing – Tutorial @ PyParis
2017
Josef Spillner
Zurich University of Applied Sciences, School of Engineering
Service Prototyping Lab (blog.zhaw.ch/icclab/)
8401 Winterthur, Switzerland
josef.spillner@zhaw.ch
June 9, 2017
Learning Objective
Learn on a practical level about different FaaS programming conventions,
runtimes, service providers and tools. Use some of the tools by yourself
to FaaSify simple Python applications.
1 Using Lambada
Snafu extracts your functions from code files.
Obtain Lambada directly from its source repository. You will furthermore
need Python 3.5 or more recent installed.
Listing 1: Obtaining Lambada
git clone https :// gitlab.com/josefspillner/lambada.git
Start by creating a file temperature.py. It contains one function and one
class which together form your «temperature application» (Listing 2).
Listing 2: Temperature application
def temperature ():
return 42.23
class CityTemperature :
def temperaturecity (self , city):
self.city = city
return 99
Now use Lambada to transform the contents into FaaS units which can still
be executed locally but are ready to be deployed in AWS Lambda (Listing 3).
1
transcript
type:
tutorial
distribution:
public
status:
final
initiative:
Service Tool-
ing
Listing 3: FaaSification process
./ lambada --local temperature.py
Then verify the generated Python file and notice its structure. Use any
editor of your choice on the newly generated file temperature_lambdafied.py.
Afterwards, check the functionality in the Python console. Run the following
(Listing 4).
Listing 4: FaaSified temperature application
python3
>>> import test_lambdafied
>>> dir( test_lambdafied )
>>> test_lambdafied .temperature ()
>>> test_lambdafied . temperature_remote (None , None)
>>> test_lambdafied . netproxy_handler ({"d": "{}", "name": "
temperaturecity ", "args": ["Winti"], "classname": "
CityTemperature "}, None)
Finally, it is time to deploy the code to AWS Lambda and execute it there.
You can run the command twice to verify that in the second case no redeploy-
ment happens (Listing 5). In parallel, you can verify the deployments in the
AWS Lambda Dashboard at https://<orgname>.signin.aws.amazon.com/console.
Listing 5: FaaSified temperature application
./ lambada temperature.py
./ lambada temperature.py # nothing happens , already deployed
2 Using Snafu
Snafu runs your functions in code files.
Start off with obtaining Snafu from its source repository.
Listing 6: Obtaining Snafu
git clone https :// github.com/ serviceprototypinglab /snafu
You can directly run Snafu without any configuration. It ships with a num-
ber of default functions in various languages. Notice how on first startup, the
interpreters for non-Python functions are compiled first. This means that while
the first startup is a bit slow, the second and subsequent ones are quote fast
(Listing 7).
Listing 7: Running Snafu
./ snafu
# type Ctrl+D
./ snafu # everything compiled
# type Ctrl+D again
2
Now run Snafu in C mode, meaning that the default interpreter is for func-
tions implemented in C. Select the sample C Fibonacci function and execute it
with a low parameter n (Listing 8).
Listing 8: Executing a C function
./ snafu -e c
# type function: fib_so.handler
# type argument: 10
# type Ctrl+D
Now remember your previous example functions used with Lambada. Obvi-
ously, Snafu can interpret this file as well. Execute Snafu on this file and explore
the execution (Listing 9).
Listing 9: Executing a Python function
./ snafu .../ path -to -lambada/temperature.py
For testing functions prior to deployment to AWS, it is convenient to use
Snafu’s control plane mode. In this mode, the default calling convention is the
same as in AWS Lambda (Listing 10).
Listing 10: Using the control plane
./snafu -control .../ path -to -lambada/temperature.py
# notice how no methods are selectable
# type Ctrl+D
# add to source: lambda_handler(event , context):return str(
temperature ())
# & run snafu -control command again
# open a second terminal , and run:
aws --endpoint -url http :// localhost :10000 lambda invoke --
function -name test. lambda_handler --payload ’{" event ":
""}’ /tmp/_out
cat /tmp/_out
3 Using Fission
Note: You will need to have Kubernetes installed with minikube + kubectl.
Ensure that the minikube context is used by kubectl. Furthermore, ensure that
your system user is in the group docker.
Listing 11: Fission script
# prepare
kubectl config use -context minikube
kubectl create -f http :// fission.io/fission.yaml
kubectl create -f http :// fission.io/fission -nodeport.yaml
export FISSION_URL=http ://$(minikube ip):31313
export FISSION_ROUTER=$(minikube ip):31314
3
# initiate
fission env create --name python --image fission/python -env
curl https :// raw. githubusercontent .com/fission/fission/
master/examples/python/hello.py > hello.py
# explore & deploy
cat hello.py
fission function create --name hello --env python --code
hello.py
# output: function ’hello ’ created
fission route create --method GET --url /hello --function
hello
# output: trigger ’35ad2fae -**** -**** -**** -679 d755fde8f ’
created
curl http :// $FISSION_ROUTER /hello
# user interface
kubectl create -f https :// raw. githubusercontent .com/fission/
fission -ui/master/docker/fission -ui.yaml
# output: deployment "fission -ui" created
# output: service "fission -ui" created
xdg -open http ://$(minikube ip):31319
4 Using OpenLambda (tentative)
Listing 12: OpenLambda script
git clone https :// github.com/open -lambda/open -lambda
cd open -lambda
sudo apt -get install libpython2 .7-dev
sudo make
bin/admin new -cluster pyparis
# returns lots of JSON
bin/admin workers -cluster pyparis
# output: Started worker: pid ...
bin/admin status -cluster pyparis
# output: Worker Pings: ...
cat quickstart/handlers/hello/lambda_func.py
# ... minimal Lambda -signature Python function
cp -r quickstart/handlers/hello pyparis/registry
curl -X POST localhost :8080/ runLambda/hello -d ’{" name ": "
Alice "}’
# -> permission denied !?
4

More Related Content

What's hot

2020.02.15 DelEx - CI/CD in AWS Cloud
2020.02.15 DelEx - CI/CD in AWS Cloud2020.02.15 DelEx - CI/CD in AWS Cloud
2020.02.15 DelEx - CI/CD in AWS CloudPeter Salnikov
 
OctoLab Cookbook: how to use composer.yml and stop creating issues about
OctoLab Cookbook: how to use composer.yml and stop creating issues aboutOctoLab Cookbook: how to use composer.yml and stop creating issues about
OctoLab Cookbook: how to use composer.yml and stop creating issues aboutKamil Samigullin
 
PyParis2018 - Python tooling for continuous deployment
PyParis2018 - Python tooling for continuous deploymentPyParis2018 - Python tooling for continuous deployment
PyParis2018 - Python tooling for continuous deploymentArthur Lutz
 
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeAcademy
 
Launching Applications
Launching ApplicationsLaunching Applications
Launching Applicationsprimeteacher32
 
OSTU - Wireshark Capture Filters (by Ray Tompkins)
OSTU - Wireshark Capture Filters (by Ray Tompkins)OSTU - Wireshark Capture Filters (by Ray Tompkins)
OSTU - Wireshark Capture Filters (by Ray Tompkins)Denny K
 
Kernel Recipes 2014 - Quick state of the art of clang
Kernel Recipes 2014 - Quick state of the art of clangKernel Recipes 2014 - Quick state of the art of clang
Kernel Recipes 2014 - Quick state of the art of clangAnne Nicolas
 
Toolfactory foam mar21_2013
Toolfactory foam mar21_2013Toolfactory foam mar21_2013
Toolfactory foam mar21_2013Ross Lazarus
 
iptables and Kubernetes
iptables and Kubernetesiptables and Kubernetes
iptables and KubernetesHungWei Chiu
 
Reactive programming in PHP
Reactive programming in PHPReactive programming in PHP
Reactive programming in PHPJohney Park
 
KubeCon EU 2016: Getting the Jobs Done With Kubernetes
KubeCon EU 2016: Getting the Jobs Done With KubernetesKubeCon EU 2016: Getting the Jobs Done With Kubernetes
KubeCon EU 2016: Getting the Jobs Done With KubernetesKubeAcademy
 
Kubernetes service with ha
Kubernetes service with haKubernetes service with ha
Kubernetes service with haSam Zheng
 
Logging library migrations - A case study for the Apache Software Foundation ...
Logging library migrations - A case study for the Apache Software Foundation ...Logging library migrations - A case study for the Apache Software Foundation ...
Logging library migrations - A case study for the Apache Software Foundation ...corpaulbezemer
 

What's hot (19)

AMC Minor Technical Issues
AMC Minor Technical IssuesAMC Minor Technical Issues
AMC Minor Technical Issues
 
python_certificate
python_certificatepython_certificate
python_certificate
 
2020.02.15 DelEx - CI/CD in AWS Cloud
2020.02.15 DelEx - CI/CD in AWS Cloud2020.02.15 DelEx - CI/CD in AWS Cloud
2020.02.15 DelEx - CI/CD in AWS Cloud
 
OctoLab Cookbook: how to use composer.yml and stop creating issues about
OctoLab Cookbook: how to use composer.yml and stop creating issues aboutOctoLab Cookbook: how to use composer.yml and stop creating issues about
OctoLab Cookbook: how to use composer.yml and stop creating issues about
 
Python to scala
Python to scalaPython to scala
Python to scala
 
PyParis2018 - Python tooling for continuous deployment
PyParis2018 - Python tooling for continuous deploymentPyParis2018 - Python tooling for continuous deployment
PyParis2018 - Python tooling for continuous deployment
 
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
 
Launching Applications
Launching ApplicationsLaunching Applications
Launching Applications
 
OSTU - Wireshark Capture Filters (by Ray Tompkins)
OSTU - Wireshark Capture Filters (by Ray Tompkins)OSTU - Wireshark Capture Filters (by Ray Tompkins)
OSTU - Wireshark Capture Filters (by Ray Tompkins)
 
K8s
K8sK8s
K8s
 
Using zone.js
Using zone.jsUsing zone.js
Using zone.js
 
Kernel Recipes 2014 - Quick state of the art of clang
Kernel Recipes 2014 - Quick state of the art of clangKernel Recipes 2014 - Quick state of the art of clang
Kernel Recipes 2014 - Quick state of the art of clang
 
Toolfactory foam mar21_2013
Toolfactory foam mar21_2013Toolfactory foam mar21_2013
Toolfactory foam mar21_2013
 
iptables and Kubernetes
iptables and Kubernetesiptables and Kubernetes
iptables and Kubernetes
 
Reactive programming in PHP
Reactive programming in PHPReactive programming in PHP
Reactive programming in PHP
 
Fun421 stephens
Fun421 stephensFun421 stephens
Fun421 stephens
 
KubeCon EU 2016: Getting the Jobs Done With Kubernetes
KubeCon EU 2016: Getting the Jobs Done With KubernetesKubeCon EU 2016: Getting the Jobs Done With Kubernetes
KubeCon EU 2016: Getting the Jobs Done With Kubernetes
 
Kubernetes service with ha
Kubernetes service with haKubernetes service with ha
Kubernetes service with ha
 
Logging library migrations - A case study for the Apache Software Foundation ...
Logging library migrations - A case study for the Apache Software Foundation ...Logging library migrations - A case study for the Apache Software Foundation ...
Logging library migrations - A case study for the Apache Software Foundation ...
 

Similar to Pythonic Perspective on Serverless Computing

Kubernetes laravel and kubernetes
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetesWilliam Stewart
 
Steps to install ns3
Steps to install ns3Steps to install ns3
Steps to install ns3DIGITAL PADM
 
Effective Building your Platform with Kubernetes == Keep it Simple
Effective Building your Platform with Kubernetes == Keep it Simple Effective Building your Platform with Kubernetes == Keep it Simple
Effective Building your Platform with Kubernetes == Keep it Simple Wojciech Barczyński
 
Scaling docker with kubernetes
Scaling docker with kubernetesScaling docker with kubernetes
Scaling docker with kubernetesLiran Cohen
 
Tensorflow in production with AWS Lambda
Tensorflow in production with AWS LambdaTensorflow in production with AWS Lambda
Tensorflow in production with AWS LambdaFabian Dubois
 
[k8s] Kubernetes terminology (1).pdf
[k8s] Kubernetes terminology (1).pdf[k8s] Kubernetes terminology (1).pdf
[k8s] Kubernetes terminology (1).pdfFrederik Wouters
 
Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Henry Schreiner
 
Parallel Processing with IPython
Parallel Processing with IPythonParallel Processing with IPython
Parallel Processing with IPythonEnthought, Inc.
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Max Kleiner
 
How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2Fernando Lopez Aguilar
 
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE LabHow to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE LabFIWARE
 
Open erp on ubuntu
Open erp on ubuntuOpen erp on ubuntu
Open erp on ubuntuIker Coranti
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developerPaul Czarkowski
 
Installing OpenCV 4 on Ubuntu 18.x
Installing OpenCV 4 on Ubuntu 18.xInstalling OpenCV 4 on Ubuntu 18.x
Installing OpenCV 4 on Ubuntu 18.xNader Karimi
 
Zero downtime deployment of micro-services with Kubernetes
Zero downtime deployment of micro-services with KubernetesZero downtime deployment of micro-services with Kubernetes
Zero downtime deployment of micro-services with KubernetesWojciech Barczyński
 
How to speed up your (API client) modules
How to speed up your (API client) modulesHow to speed up your (API client) modules
How to speed up your (API client) modulesGonéri Le Bouder
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy Systemadrian_nye
 

Similar to Pythonic Perspective on Serverless Computing (20)

Kubernetes laravel and kubernetes
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetes
 
Steps to install ns3
Steps to install ns3Steps to install ns3
Steps to install ns3
 
HPC_MPI_CICID_OA.pptx
HPC_MPI_CICID_OA.pptxHPC_MPI_CICID_OA.pptx
HPC_MPI_CICID_OA.pptx
 
Effective Building your Platform with Kubernetes == Keep it Simple
Effective Building your Platform with Kubernetes == Keep it Simple Effective Building your Platform with Kubernetes == Keep it Simple
Effective Building your Platform with Kubernetes == Keep it Simple
 
Scaling docker with kubernetes
Scaling docker with kubernetesScaling docker with kubernetes
Scaling docker with kubernetes
 
Tensorflow in production with AWS Lambda
Tensorflow in production with AWS LambdaTensorflow in production with AWS Lambda
Tensorflow in production with AWS Lambda
 
[k8s] Kubernetes terminology (1).pdf
[k8s] Kubernetes terminology (1).pdf[k8s] Kubernetes terminology (1).pdf
[k8s] Kubernetes terminology (1).pdf
 
Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023
 
Parallel Processing with IPython
Parallel Processing with IPythonParallel Processing with IPython
Parallel Processing with IPython
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
 
How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2How to deploy spark instance using ansible 2.0 in fiware lab v2
How to deploy spark instance using ansible 2.0 in fiware lab v2
 
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE LabHow to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
How to Deploy Spark Instance Using Ansible 2.0 in FIWARE Lab
 
Open erp on ubuntu
Open erp on ubuntuOpen erp on ubuntu
Open erp on ubuntu
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developer
 
Installing OpenCV 4 on Ubuntu 18.x
Installing OpenCV 4 on Ubuntu 18.xInstalling OpenCV 4 on Ubuntu 18.x
Installing OpenCV 4 on Ubuntu 18.x
 
Zero downtime deployment of micro-services with Kubernetes
Zero downtime deployment of micro-services with KubernetesZero downtime deployment of micro-services with Kubernetes
Zero downtime deployment of micro-services with Kubernetes
 
How to speed up your (API client) modules
How to speed up your (API client) modulesHow to speed up your (API client) modules
How to speed up your (API client) modules
 
Open Dayligth usando SDN-NFV
Open Dayligth usando SDN-NFVOpen Dayligth usando SDN-NFV
Open Dayligth usando SDN-NFV
 
kubernetes for beginners
kubernetes for beginnerskubernetes for beginners
kubernetes for beginners
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 

More from Pôle Systematic Paris-Region

OSIS19_IoT :Transparent remote connectivity to short-range IoT devices, by Na...
OSIS19_IoT :Transparent remote connectivity to short-range IoT devices, by Na...OSIS19_IoT :Transparent remote connectivity to short-range IoT devices, by Na...
OSIS19_IoT :Transparent remote connectivity to short-range IoT devices, by Na...Pôle Systematic Paris-Region
 
OSIS19_Cloud : SAFC: Scheduling and Allocation Framework for Containers in a ...
OSIS19_Cloud : SAFC: Scheduling and Allocation Framework for Containers in a ...OSIS19_Cloud : SAFC: Scheduling and Allocation Framework for Containers in a ...
OSIS19_Cloud : SAFC: Scheduling and Allocation Framework for Containers in a ...Pôle Systematic Paris-Region
 
OSIS19_Cloud : Qu’apporte l’observabilité à la gestion de configuration? par ...
OSIS19_Cloud : Qu’apporte l’observabilité à la gestion de configuration? par ...OSIS19_Cloud : Qu’apporte l’observabilité à la gestion de configuration? par ...
OSIS19_Cloud : Qu’apporte l’observabilité à la gestion de configuration? par ...Pôle Systematic Paris-Region
 
OSIS19_Cloud : Performance and power management in virtualized data centers, ...
OSIS19_Cloud : Performance and power management in virtualized data centers, ...OSIS19_Cloud : Performance and power management in virtualized data centers, ...
OSIS19_Cloud : Performance and power management in virtualized data centers, ...Pôle Systematic Paris-Region
 
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...Pôle Systematic Paris-Region
 
OSIS19_Cloud : Attribution automatique de ressources pour micro-services, Alt...
OSIS19_Cloud : Attribution automatique de ressources pour micro-services, Alt...OSIS19_Cloud : Attribution automatique de ressources pour micro-services, Alt...
OSIS19_Cloud : Attribution automatique de ressources pour micro-services, Alt...Pôle Systematic Paris-Region
 
OSIS19_IoT : State of the art in security for embedded systems and IoT, by Pi...
OSIS19_IoT : State of the art in security for embedded systems and IoT, by Pi...OSIS19_IoT : State of the art in security for embedded systems and IoT, by Pi...
OSIS19_IoT : State of the art in security for embedded systems and IoT, by Pi...Pôle Systematic Paris-Region
 
Osis19_IoT: Proof of Pointer Programs with Ownership in SPARK, by Yannick Moy
Osis19_IoT: Proof of Pointer Programs with Ownership in SPARK, by Yannick MoyOsis19_IoT: Proof of Pointer Programs with Ownership in SPARK, by Yannick Moy
Osis19_IoT: Proof of Pointer Programs with Ownership in SPARK, by Yannick MoyPôle Systematic Paris-Region
 
Osis18_Cloud : Virtualisation efficace d’architectures NUMA
Osis18_Cloud : Virtualisation efficace d’architectures NUMAOsis18_Cloud : Virtualisation efficace d’architectures NUMA
Osis18_Cloud : Virtualisation efficace d’architectures NUMAPôle Systematic Paris-Region
 
Osis18_Cloud : DeepTorrent Stockage distribué perenne basé sur Bittorrent
Osis18_Cloud : DeepTorrent Stockage distribué perenne basé sur BittorrentOsis18_Cloud : DeepTorrent Stockage distribué perenne basé sur Bittorrent
Osis18_Cloud : DeepTorrent Stockage distribué perenne basé sur BittorrentPôle Systematic Paris-Region
 
OSIS18_IoT: L'approche machine virtuelle pour les microcontrôleurs, le projet...
OSIS18_IoT: L'approche machine virtuelle pour les microcontrôleurs, le projet...OSIS18_IoT: L'approche machine virtuelle pour les microcontrôleurs, le projet...
OSIS18_IoT: L'approche machine virtuelle pour les microcontrôleurs, le projet...Pôle Systematic Paris-Region
 
OSIS18_IoT: La securite des objets connectes a bas cout avec l'os et riot
OSIS18_IoT: La securite des objets connectes a bas cout avec l'os et riotOSIS18_IoT: La securite des objets connectes a bas cout avec l'os et riot
OSIS18_IoT: La securite des objets connectes a bas cout avec l'os et riotPôle Systematic Paris-Region
 
OSIS18_IoT : Solution de mise au point pour les systemes embarques, par Julio...
OSIS18_IoT : Solution de mise au point pour les systemes embarques, par Julio...OSIS18_IoT : Solution de mise au point pour les systemes embarques, par Julio...
OSIS18_IoT : Solution de mise au point pour les systemes embarques, par Julio...Pôle Systematic Paris-Region
 
OSIS18_IoT : Securisation du reseau des objets connectes, par Nicolas LE SAUZ...
OSIS18_IoT : Securisation du reseau des objets connectes, par Nicolas LE SAUZ...OSIS18_IoT : Securisation du reseau des objets connectes, par Nicolas LE SAUZ...
OSIS18_IoT : Securisation du reseau des objets connectes, par Nicolas LE SAUZ...Pôle Systematic Paris-Region
 
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...Pôle Systematic Paris-Region
 
OSIS18_IoT : RTEMS pour l'IoT professionnel, par Pierre Ficheux (Smile ECS)
OSIS18_IoT : RTEMS pour l'IoT professionnel, par Pierre Ficheux (Smile ECS)OSIS18_IoT : RTEMS pour l'IoT professionnel, par Pierre Ficheux (Smile ECS)
OSIS18_IoT : RTEMS pour l'IoT professionnel, par Pierre Ficheux (Smile ECS)Pôle Systematic Paris-Region
 
PyParis 2017 / Un mooc python, by thierry parmentelat
PyParis 2017 / Un mooc python, by thierry parmentelatPyParis 2017 / Un mooc python, by thierry parmentelat
PyParis 2017 / Un mooc python, by thierry parmentelatPôle Systematic Paris-Region
 

More from Pôle Systematic Paris-Region (20)

OSIS19_IoT :Transparent remote connectivity to short-range IoT devices, by Na...
OSIS19_IoT :Transparent remote connectivity to short-range IoT devices, by Na...OSIS19_IoT :Transparent remote connectivity to short-range IoT devices, by Na...
OSIS19_IoT :Transparent remote connectivity to short-range IoT devices, by Na...
 
OSIS19_Cloud : SAFC: Scheduling and Allocation Framework for Containers in a ...
OSIS19_Cloud : SAFC: Scheduling and Allocation Framework for Containers in a ...OSIS19_Cloud : SAFC: Scheduling and Allocation Framework for Containers in a ...
OSIS19_Cloud : SAFC: Scheduling and Allocation Framework for Containers in a ...
 
OSIS19_Cloud : Qu’apporte l’observabilité à la gestion de configuration? par ...
OSIS19_Cloud : Qu’apporte l’observabilité à la gestion de configuration? par ...OSIS19_Cloud : Qu’apporte l’observabilité à la gestion de configuration? par ...
OSIS19_Cloud : Qu’apporte l’observabilité à la gestion de configuration? par ...
 
OSIS19_Cloud : Performance and power management in virtualized data centers, ...
OSIS19_Cloud : Performance and power management in virtualized data centers, ...OSIS19_Cloud : Performance and power management in virtualized data centers, ...
OSIS19_Cloud : Performance and power management in virtualized data centers, ...
 
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
 
OSIS19_Cloud : Attribution automatique de ressources pour micro-services, Alt...
OSIS19_Cloud : Attribution automatique de ressources pour micro-services, Alt...OSIS19_Cloud : Attribution automatique de ressources pour micro-services, Alt...
OSIS19_Cloud : Attribution automatique de ressources pour micro-services, Alt...
 
OSIS19_IoT : State of the art in security for embedded systems and IoT, by Pi...
OSIS19_IoT : State of the art in security for embedded systems and IoT, by Pi...OSIS19_IoT : State of the art in security for embedded systems and IoT, by Pi...
OSIS19_IoT : State of the art in security for embedded systems and IoT, by Pi...
 
Osis19_IoT: Proof of Pointer Programs with Ownership in SPARK, by Yannick Moy
Osis19_IoT: Proof of Pointer Programs with Ownership in SPARK, by Yannick MoyOsis19_IoT: Proof of Pointer Programs with Ownership in SPARK, by Yannick Moy
Osis19_IoT: Proof of Pointer Programs with Ownership in SPARK, by Yannick Moy
 
Osis18_Cloud : Pas de commun sans communauté ?
Osis18_Cloud : Pas de commun sans communauté ?Osis18_Cloud : Pas de commun sans communauté ?
Osis18_Cloud : Pas de commun sans communauté ?
 
Osis18_Cloud : Projet Wolphin
Osis18_Cloud : Projet Wolphin Osis18_Cloud : Projet Wolphin
Osis18_Cloud : Projet Wolphin
 
Osis18_Cloud : Virtualisation efficace d’architectures NUMA
Osis18_Cloud : Virtualisation efficace d’architectures NUMAOsis18_Cloud : Virtualisation efficace d’architectures NUMA
Osis18_Cloud : Virtualisation efficace d’architectures NUMA
 
Osis18_Cloud : DeepTorrent Stockage distribué perenne basé sur Bittorrent
Osis18_Cloud : DeepTorrent Stockage distribué perenne basé sur BittorrentOsis18_Cloud : DeepTorrent Stockage distribué perenne basé sur Bittorrent
Osis18_Cloud : DeepTorrent Stockage distribué perenne basé sur Bittorrent
 
Osis18_Cloud : Software-heritage
Osis18_Cloud : Software-heritageOsis18_Cloud : Software-heritage
Osis18_Cloud : Software-heritage
 
OSIS18_IoT: L'approche machine virtuelle pour les microcontrôleurs, le projet...
OSIS18_IoT: L'approche machine virtuelle pour les microcontrôleurs, le projet...OSIS18_IoT: L'approche machine virtuelle pour les microcontrôleurs, le projet...
OSIS18_IoT: L'approche machine virtuelle pour les microcontrôleurs, le projet...
 
OSIS18_IoT: La securite des objets connectes a bas cout avec l'os et riot
OSIS18_IoT: La securite des objets connectes a bas cout avec l'os et riotOSIS18_IoT: La securite des objets connectes a bas cout avec l'os et riot
OSIS18_IoT: La securite des objets connectes a bas cout avec l'os et riot
 
OSIS18_IoT : Solution de mise au point pour les systemes embarques, par Julio...
OSIS18_IoT : Solution de mise au point pour les systemes embarques, par Julio...OSIS18_IoT : Solution de mise au point pour les systemes embarques, par Julio...
OSIS18_IoT : Solution de mise au point pour les systemes embarques, par Julio...
 
OSIS18_IoT : Securisation du reseau des objets connectes, par Nicolas LE SAUZ...
OSIS18_IoT : Securisation du reseau des objets connectes, par Nicolas LE SAUZ...OSIS18_IoT : Securisation du reseau des objets connectes, par Nicolas LE SAUZ...
OSIS18_IoT : Securisation du reseau des objets connectes, par Nicolas LE SAUZ...
 
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
 
OSIS18_IoT : RTEMS pour l'IoT professionnel, par Pierre Ficheux (Smile ECS)
OSIS18_IoT : RTEMS pour l'IoT professionnel, par Pierre Ficheux (Smile ECS)OSIS18_IoT : RTEMS pour l'IoT professionnel, par Pierre Ficheux (Smile ECS)
OSIS18_IoT : RTEMS pour l'IoT professionnel, par Pierre Ficheux (Smile ECS)
 
PyParis 2017 / Un mooc python, by thierry parmentelat
PyParis 2017 / Un mooc python, by thierry parmentelatPyParis 2017 / Un mooc python, by thierry parmentelat
PyParis 2017 / Un mooc python, by thierry parmentelat
 

Recently uploaded

All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
A PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxA PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxatharvdev2010
 
Automation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions managementAutomation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions managementDianaGray10
 
Which standard is best for your content?
Which standard is best for your content?Which standard is best for your content?
Which standard is best for your content?Rustici Software
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneUiPathCommunity
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdfHCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdfROWELL MARQUINA
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Dublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxDublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxKunal Gupta
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfROWELL MARQUINA
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Software Security in the Real World w/Kelsey Hightower
Software Security in the Real World w/Kelsey HightowerSoftware Security in the Real World w/Kelsey Hightower
Software Security in the Real World w/Kelsey HightowerAnchore
 
Introduction-to-Wazuh-and-its-integration.pptx
Introduction-to-Wazuh-and-its-integration.pptxIntroduction-to-Wazuh-and-its-integration.pptx
Introduction-to-Wazuh-and-its-integration.pptxmprakaash5
 

Recently uploaded (20)

All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
A PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptxA PowerPoint Presentation on Vikram Lander pptx
A PowerPoint Presentation on Vikram Lander pptx
 
Automation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions managementAutomation Ops Series: Session 3 - Solutions management
Automation Ops Series: Session 3 - Solutions management
 
Which standard is best for your content?
Which standard is best for your content?Which standard is best for your content?
Which standard is best for your content?
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyone
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdfHCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
HCI Lesson 1 - Introduction to Human-Computer Interaction.pdf
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Dublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptxDublin_mulesoft_meetup_API_specifications.pptx
Dublin_mulesoft_meetup_API_specifications.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdf
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Software Security in the Real World w/Kelsey Hightower
Software Security in the Real World w/Kelsey HightowerSoftware Security in the Real World w/Kelsey Hightower
Software Security in the Real World w/Kelsey Hightower
 
Introduction-to-Wazuh-and-its-integration.pptx
Introduction-to-Wazuh-and-its-integration.pptxIntroduction-to-Wazuh-and-its-integration.pptx
Introduction-to-Wazuh-and-its-integration.pptx
 

Pythonic Perspective on Serverless Computing

  • 1. Function-as-a-Service: A Pythonic Perspective on Serverless Computing – Tutorial @ PyParis 2017 Josef Spillner Zurich University of Applied Sciences, School of Engineering Service Prototyping Lab (blog.zhaw.ch/icclab/) 8401 Winterthur, Switzerland josef.spillner@zhaw.ch June 9, 2017 Learning Objective Learn on a practical level about different FaaS programming conventions, runtimes, service providers and tools. Use some of the tools by yourself to FaaSify simple Python applications. 1 Using Lambada Snafu extracts your functions from code files. Obtain Lambada directly from its source repository. You will furthermore need Python 3.5 or more recent installed. Listing 1: Obtaining Lambada git clone https :// gitlab.com/josefspillner/lambada.git Start by creating a file temperature.py. It contains one function and one class which together form your «temperature application» (Listing 2). Listing 2: Temperature application def temperature (): return 42.23 class CityTemperature : def temperaturecity (self , city): self.city = city return 99 Now use Lambada to transform the contents into FaaS units which can still be executed locally but are ready to be deployed in AWS Lambda (Listing 3). 1 transcript type: tutorial distribution: public status: final initiative: Service Tool- ing
  • 2. Listing 3: FaaSification process ./ lambada --local temperature.py Then verify the generated Python file and notice its structure. Use any editor of your choice on the newly generated file temperature_lambdafied.py. Afterwards, check the functionality in the Python console. Run the following (Listing 4). Listing 4: FaaSified temperature application python3 >>> import test_lambdafied >>> dir( test_lambdafied ) >>> test_lambdafied .temperature () >>> test_lambdafied . temperature_remote (None , None) >>> test_lambdafied . netproxy_handler ({"d": "{}", "name": " temperaturecity ", "args": ["Winti"], "classname": " CityTemperature "}, None) Finally, it is time to deploy the code to AWS Lambda and execute it there. You can run the command twice to verify that in the second case no redeploy- ment happens (Listing 5). In parallel, you can verify the deployments in the AWS Lambda Dashboard at https://<orgname>.signin.aws.amazon.com/console. Listing 5: FaaSified temperature application ./ lambada temperature.py ./ lambada temperature.py # nothing happens , already deployed 2 Using Snafu Snafu runs your functions in code files. Start off with obtaining Snafu from its source repository. Listing 6: Obtaining Snafu git clone https :// github.com/ serviceprototypinglab /snafu You can directly run Snafu without any configuration. It ships with a num- ber of default functions in various languages. Notice how on first startup, the interpreters for non-Python functions are compiled first. This means that while the first startup is a bit slow, the second and subsequent ones are quote fast (Listing 7). Listing 7: Running Snafu ./ snafu # type Ctrl+D ./ snafu # everything compiled # type Ctrl+D again 2
  • 3. Now run Snafu in C mode, meaning that the default interpreter is for func- tions implemented in C. Select the sample C Fibonacci function and execute it with a low parameter n (Listing 8). Listing 8: Executing a C function ./ snafu -e c # type function: fib_so.handler # type argument: 10 # type Ctrl+D Now remember your previous example functions used with Lambada. Obvi- ously, Snafu can interpret this file as well. Execute Snafu on this file and explore the execution (Listing 9). Listing 9: Executing a Python function ./ snafu .../ path -to -lambada/temperature.py For testing functions prior to deployment to AWS, it is convenient to use Snafu’s control plane mode. In this mode, the default calling convention is the same as in AWS Lambda (Listing 10). Listing 10: Using the control plane ./snafu -control .../ path -to -lambada/temperature.py # notice how no methods are selectable # type Ctrl+D # add to source: lambda_handler(event , context):return str( temperature ()) # & run snafu -control command again # open a second terminal , and run: aws --endpoint -url http :// localhost :10000 lambda invoke -- function -name test. lambda_handler --payload ’{" event ": ""}’ /tmp/_out cat /tmp/_out 3 Using Fission Note: You will need to have Kubernetes installed with minikube + kubectl. Ensure that the minikube context is used by kubectl. Furthermore, ensure that your system user is in the group docker. Listing 11: Fission script # prepare kubectl config use -context minikube kubectl create -f http :// fission.io/fission.yaml kubectl create -f http :// fission.io/fission -nodeport.yaml export FISSION_URL=http ://$(minikube ip):31313 export FISSION_ROUTER=$(minikube ip):31314 3
  • 4. # initiate fission env create --name python --image fission/python -env curl https :// raw. githubusercontent .com/fission/fission/ master/examples/python/hello.py > hello.py # explore & deploy cat hello.py fission function create --name hello --env python --code hello.py # output: function ’hello ’ created fission route create --method GET --url /hello --function hello # output: trigger ’35ad2fae -**** -**** -**** -679 d755fde8f ’ created curl http :// $FISSION_ROUTER /hello # user interface kubectl create -f https :// raw. githubusercontent .com/fission/ fission -ui/master/docker/fission -ui.yaml # output: deployment "fission -ui" created # output: service "fission -ui" created xdg -open http ://$(minikube ip):31319 4 Using OpenLambda (tentative) Listing 12: OpenLambda script git clone https :// github.com/open -lambda/open -lambda cd open -lambda sudo apt -get install libpython2 .7-dev sudo make bin/admin new -cluster pyparis # returns lots of JSON bin/admin workers -cluster pyparis # output: Started worker: pid ... bin/admin status -cluster pyparis # output: Worker Pings: ... cat quickstart/handlers/hello/lambda_func.py # ... minimal Lambda -signature Python function cp -r quickstart/handlers/hello pyparis/registry curl -X POST localhost :8080/ runLambda/hello -d ’{" name ": " Alice "}’ # -> permission denied !? 4