Skip to content
Snippets Groups Projects
Commit 7e905fa7 authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

L2SS-950-create-macros

parent 6c960fa9
No related branches found
No related tags found
1 merge request!458Resolve L2SS-950 "Jupyter macros"
%% Cell type:code id:c0494f3f-9db5-44cf-b70b-66a4e4180e71 tags:
``` python
# load the macro
%store -r __start_devices
```
%% Cell type:code id:f54daaa7-848f-4a5d-b6c6-70630e3c9474 tags:
``` python
__start_devices
```
%% Output
RECV(stat/recv/1) is in state ON
SDP(stat/sdp/1) is in state ON
%% Cell type:code id:a018bfb3-1eaa-437c-8866-19266902e9d4 tags:
``` python
```
%% Cell type:code id:69bb10e4-133e-40da-aa35-70da4b07d919 tags:
``` python
# Start all devices
devices = [recv, sdp]
for device in devices:
if device.state() == DevState.FAULT:
device.Off()
if device.state() == DevState.OFF:
device.warm_boot()
if device.state() == DevState.INIT:
device.Standby()
if device.state() == DevState.STANDBY:
device.On()
print(f'{device} is in state {device.state()}')
```
%% Cell type:code id:6cad779f-6c9a-44a3-bbc8-9017cfb0f903 tags:
``` python
# %macro -q <macro_name> <cell_number>
%macro -q __start_devices 1
```
%% Cell type:code id:fc8cc0eb-2dcd-4905-9fb6-7bdbaf5b4650 tags:
``` python
recv.off()
recv.state()
```
%% Cell type:code id:0905f4b9-918f-4207-99d9-c73900271493 tags:
``` python
__start_devices
```
%% Cell type:code id:846e6813-58c5-4f1d-a156-8e19c073b2bf tags:
``` python
recv.state()
```
%% Cell type:code id:4e3b628e-7283-4d8d-8fd9-188142c810d1 tags:
``` python
# store the macro
%store __start_devices
```
%% Cell type:code id:ea34b186-48f5-4220-9951-2b61df9efe97 tags:
``` python
# load the macro
%store -r __start_devices
```
%% Cell type:code id:a7bc9113-dc8c-40b9-9d03-0f9cf275a9e5 tags:
``` python
__start_devices
```
%% Cell type:code id:b3644931-84fb-44e8-871b-49c32c3f9ec6 tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment