Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
artiq_experiments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Nunez Barreto
artiq_experiments
Commits
ba5e6968
Commit
ba5e6968
authored
Sep 06, 2021
by
Nicolas Nunez Barreto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://code.df.uba.ar/nnunez/artiq_experiments
parents
d339f6bd
d2f3bd99
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
0 deletions
+60
-0
histograms_chtime_altura_vsPot397.png
...isis/plots/20210703/histograms_chtime_altura_vsPot397.png
+0
-0
histograms_chtime_altura_vsPot397_corregido.png
.../20210703/histograms_chtime_altura_vsPot397_corregido.png
+0
-0
Espectro1.png
analisis/plots/20210708/Espectro1.png
+0
-0
Espectro2.png
analisis/plots/20210708/Espectro2.png
+0
-0
Watchdog.py
analisis/plots/Tests/Watchdog.py
+60
-0
No files found.
analisis/plots/20210703/histograms_chtime_altura_vsPot397.png
deleted
100644 → 0
View file @
d339f6bd
68.4 KB
analisis/plots/20210703/histograms_chtime_altura_vsPot397_corregido.png
0 → 100644
View file @
ba5e6968
79.5 KB
analisis/plots/20210708/Espectro1.png
0 → 100644
View file @
ba5e6968
23.5 KB
analisis/plots/20210708/Espectro2.png
0 → 100644
View file @
ba5e6968
21.5 KB
analisis/plots/Tests/Watchdog.py
0 → 100755
View file @
ba5e6968
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 24 20:15:09 2021
@author: oem
"""
#!/usr/bin/python
# file: watchdog.py
# license: MIT License
import
signal
import
time
import
random
class
Watchdog
(
Exception
):
def
__init__
(
self
,
time
=
5
):
self
.
time
=
time
def
__enter__
(
self
):
signal
.
signal
(
signal
.
SIGALRM
,
self
.
handler
)
signal
.
alarm
(
self
.
time
)
def
__exit__
(
self
,
type
,
value
,
traceback
):
signal
.
alarm
(
0
)
def
handler
(
self
,
signum
,
frame
):
raise
self
def
__str__
(
self
):
return
"The code you executed took more than
%
ds to complete"
%
self
.
time
# import the class
#from watchdog import Watchdog
def
long_function
():
r
=
random
.
random
()
print
(
f
'random: {r}'
)
t_rand
=
2
*
r
time
.
sleep
(
t_rand
)
return
t_rand
# don't allow long_function to take more than 5 seconds to complete
tiempos
=
[]
for
i
in
range
(
10
):
try
:
with
Watchdog
(
1
):
t0
=
long_function
()
print
(
t0
)
tiempos
.
append
(
t0
)
except
Watchdog
:
print
(
"long_function() took too long to complete"
)
tiempos
.
append
(
0
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment