-
Notifications
You must be signed in to change notification settings - Fork 347
Heartbeat #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Heartbeat #294
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7b2d366
heartbeat method
b5cb597
add config module
eendebakpt c833c17
add logging module
eendebakpt 198f779
add zmq logging handler
eendebakpt 13d46bc
make heartbeat code work
eendebakpt 56bdc44
autopep8
eendebakpt 527d190
remove bot warnings
eendebakpt fda88e0
add kill pid button to GUI
eendebakpt 73dcc6b
make logging work for all servers
eendebakpt 4913d9b
fix bot warnings
eendebakpt 8265c90
clean up code
eendebakpt 9430d1e
add name of process to heartbeat
eendebakpt 410ed0b
fix missing signal on windows
a7567e5
limit output rate
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
|
|
||
| import os | ||
| import tempfile | ||
|
|
||
| addzmqlogging = os.environ.get('ZMQLOGGING', 1) | ||
|
|
||
| heartbeatfile = os.path.join(tempfile.gettempdir(), r'qcodes-heartbeat.bin' ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import os | ||
| import mmap | ||
|
|
||
| from qcodes import config | ||
|
|
||
|
|
||
| def makeHeartBeatFile(bfile, reinit=False): | ||
| if (not os.path.exists(bfile)) or reinit: | ||
| f = open(bfile, 'wb') | ||
| f.write(bytes([99, 1])) # heartbeat on | ||
| f.close() | ||
|
|
||
|
|
||
| def initHeartBeat(bfile, reinit=False): | ||
| ''' Initialize connection to heartbeat for writing, use with setHeartBeat ''' | ||
| if (not os.path.exists(bfile)) or reinit: | ||
| f = open(bfile, 'wb') | ||
| f.write(bytes([99, 1])) # heartbeat on | ||
| f.close() | ||
|
|
||
| f = open(bfile, 'a+b') | ||
| f.seek(0) | ||
| m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_WRITE) | ||
| m.flush() | ||
| # print(m[0]) | ||
| # print(m[1]) | ||
| # print('size %d' % m.size() ) | ||
|
|
||
| return m | ||
|
|
||
|
|
||
| def openHeartBeat(bfile): | ||
| f = open(bfile, 'r') | ||
| m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) | ||
| return m | ||
|
|
||
|
|
||
| def setHeartBeat(m, value): | ||
| ''' Set heartbeat value ''' | ||
| m[1] = value | ||
|
|
||
|
|
||
| def readHeartBeat(m): | ||
| ''' Return heartbeat value ''' | ||
| return m[1] | ||
|
|
||
|
|
||
| _bfile = config.heartbeatfile | ||
| makeHeartBeatFile(_bfile) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.