[ SRE_ARENA ]
Roadmap
System Design
SREdle
⚡ 1420 ELO
OP
☰
←
BACK TO ROADMAP
FUNCTIONS & SCOPE
Functions & Scope: Reusable Infrastructure
System Architecture Visualization
Call Function
restart(target)
Definition
def restart(x):
Local Scope
Variables Isolated
Return
return True
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Defining Functions
Arguments & kwargs
Scope
Lambda Functions
DOWNLOADING CONCEPT: DEFINING FUNCTIONS...
↳
Use the
def
keyword to define a function.
↳
Functions keep your automation scripts modular and testable.
python
def get_instance_ip(instance_id): # logic here return ip_address
▲ LIVE INCIDENT
A script expects a modified global variable but sees the old one.
sre@arena:~/python-functions
sre@arena
:
~
$
python3 config_loader.py
▶ EXECUTE COMMAND