-
Notifications
You must be signed in to change notification settings - Fork 84
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
Fix Stress Tests #4406
Merged
Merged
Fix Stress Tests #4406
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
553ea19
bump version to 1.6.1
wwwjn 887ca29
Merge remote-tracking branch 'origin/master' into rc1.6.1
wwwjn 11e970b
fix mysql db deadlock
AndrewJGaut 06a47b7
do upload first so we can check for deadlock
AndrewJGaut e54130f
minor update
AndrewJGaut 71a6ae8
Modified the code to use better iterations per disk check to be more …
AndrewJGaut 0bcbef0
add changes to increment time used as well
AndrewJGaut 7b81ae9
revert chnages from rc1.6.1 since I acttually branched off from that …
AndrewJGaut 1d48e8a
minor change for debugging stress tests
AndrewJGaut ddaaf42
minor changes
AndrewJGaut c1a8235
Merge branch 'master' of github.com:codalab/codalab-worksheets into f…
AndrewJGaut bf391af
update stress tests to get more fine-grained information about what m…
AndrewJGaut 57aa16f
update worker manager to log image name
AndrewJGaut f426320
small changes to try and debug stress test issue
AndrewJGaut d6d7891
get remaining tests to pass
AndrewJGaut d047df9
Add in better error logging for send_json_message
AndrewJGaut 2a1207a
minor update to help with finalization issue
AndrewJGaut 164216e
Merge branch 'master' of github.com:codalab/codalab-worksheets into f…
AndrewJGaut 9845591
Address comments
AndrewJGaut 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import io | ||
import signal | ||
import subprocess | ||
import sys | ||
import time | ||
import traceback | ||
|
||
global cl | ||
|
@@ -179,3 +181,48 @@ def cleanup(cl, tag, should_wait=True): | |
run_command([cl, 'wrm', uuid, '--force']) | ||
worksheets_removed += 1 | ||
print('Removed {} bundles and {} worksheets.'.format(bundles_removed, worksheets_removed)) | ||
|
||
|
||
class timer: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uppercase? |
||
""" | ||
Class that uses signal to interrupt functions while they're running | ||
if they run for longer than timeout_seconds. | ||
Can also be used to time how long functions take within its context manager. | ||
Used for the timing tests. | ||
""" | ||
|
||
def __init__(self, timeout_seconds=1, handle_timeouts=True, uuid=None): | ||
""" | ||
A class that can be used as a context manager to ensure that code within that context manager times out | ||
after timeout_seconds time and which times the execution of code within the context manager. | ||
Parameters: | ||
timeout_seconds (float): Amount of time before execution in context manager is interrupted for timeout | ||
handle_timeouts (bool): If True, do not timeout, only return the time taken for execution in context manager. | ||
uuid (str): Uuid of bundles running within context manager. | ||
""" | ||
self.handle_timeouts = handle_timeouts | ||
self.timeout_seconds = timeout_seconds | ||
self.uuid = None | ||
|
||
def handle_timeout(self, signum, frame): | ||
timeout_message = "Timeout ocurred" | ||
if self.uuid: | ||
timeout_message += " while waiting for %s to run" % self.uuid | ||
raise TimeoutError(timeout_message) | ||
|
||
def time_elapsed(self): | ||
return time.time() - self.start_time | ||
|
||
def __enter__(self): | ||
self.start_time = time.time() | ||
if self.handle_timeouts: | ||
signal.signal(signal.SIGALRM, self.handle_timeout) | ||
signal.setitimer(signal.ITIMER_REAL, self.timeout_seconds, self.timeout_seconds) | ||
|
||
# now, reset itimer. | ||
signal.setitimer(signal.ITIMER_REAL, 0, 0) | ||
|
||
def __exit__(self, type, value, traceback): | ||
self.time_elapsed = time.time() - self.start_time | ||
if self.handle_timeouts: | ||
signal.alarm(0) |
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.
can we shorten this docstring? probably a bit too much detail for posterity