Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
5779e4a1
Commit
5779e4a1
authored
3 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
Added notebook to start all devices known to SC
parent
f906862e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jupyter-notebooks/Start All Devices.ipynb
+73
-0
73 additions, 0 deletions
jupyter-notebooks/Start All Devices.ipynb
with
73 additions
and
0 deletions
jupyter-notebooks/Start All Devices.ipynb
0 → 100644
+
73
−
0
View file @
5779e4a1
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"id": "social-massachusetts",
"metadata": {},
"outputs": [],
"source": [
"def force_start(device):\n",
" if device.state() == DevState.FAULT:\n",
" device.Off()\n",
" if device.state() == DevState.OFF:\n",
" device.initialise()\n",
" if device.state() == DevState.INIT:\n",
" device.Standby()\n",
" if device.state() == DevState.STANDBY:\n",
" device.On()\n",
" \n",
" return device.state()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "defined-apache",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Device PCC(lts/pcc/1) is now in state FAULT\n",
"Device SDP(lts/sdp/1) is now in state ON\n"
]
}
],
"source": [
"for d in devices:\n",
" print(\"Device %s is now in state %s\" % (d, force_start(d)))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "superior-wheel",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "StationControl",
"language": "python",
"name": "stationcontrol"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:code id:social-massachusetts tags:
```
python
def
force_start
(
device
):
if
device
.
state
()
==
DevState
.
FAULT
:
device
.
Off
()
if
device
.
state
()
==
DevState
.
OFF
:
device
.
initialise
()
if
device
.
state
()
==
DevState
.
INIT
:
device
.
Standby
()
if
device
.
state
()
==
DevState
.
STANDBY
:
device
.
On
()
return
device
.
state
()
```
%% Cell type:code id:defined-apache tags:
```
python
for
d
in
devices
:
print
(
"
Device %s is now in state %s
"
%
(
d
,
force_start
(
d
)))
```
%% Output
Device PCC(lts/pcc/1) is now in state FAULT
Device SDP(lts/sdp/1) is now in state ON
%% Cell type:code id:superior-wheel tags:
```
python
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment