-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/digitalmethodsinitiative/…
- Loading branch information
Showing
74 changed files
with
1,674 additions
and
609 deletions.
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
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 |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
__maintainer__ = "Dale Wahl" | ||
__email__ = "[email protected]" | ||
|
||
from common.lib.helpers import strip_tags | ||
|
||
|
||
class DmiServiceManagerException(Exception): | ||
""" | ||
|
@@ -30,6 +32,12 @@ class DsmOutOfMemory(DmiServiceManagerException): | |
pass | ||
|
||
|
||
class DsmConnectionError(DmiServiceManagerException): | ||
""" | ||
Raised when there is a problem with the configuration settings. | ||
""" | ||
pass | ||
|
||
class DmiServiceManager: | ||
""" | ||
Class to manage interactions with a DMI Service Manager server. | ||
|
@@ -60,12 +68,17 @@ def check_gpu_memory_available(self, service_endpoint): | |
api_endpoint = self.server_address + "check_gpu_mem/" + service_endpoint | ||
resp = requests.get(api_endpoint, timeout=30) | ||
if resp.status_code == 200: | ||
return True, resp.json() | ||
elif resp.status_code in [400, 404, 500, 503]: | ||
return False, resp.json() | ||
return resp.json() | ||
elif resp.status_code == 503: | ||
# TODO: retry later (increase delay in dmi_service_manager class and interrupt w/ retry)? DSM could possibly manage jobs in queue | ||
# Processor could run CPU mode, but DSM needs to run different container (container fails if GPU enabled but not available) | ||
raise DsmOutOfMemory("DMI Service Manager server out of GPU memory.") | ||
else: | ||
self.processor.log.warning("Unknown response from DMI Service Manager: %s" % resp.text) | ||
return False, None | ||
try: | ||
reason = resp.json()['reason'] | ||
except JSONDecodeError: | ||
reason = strip_tags(resp.text) | ||
raise DsmConnectionError(f"Connection Error {resp.status_code}: {reason}") | ||
|
||
def process_files(self, input_file_dir, filenames, output_file_dir, server_file_collection_name, server_results_folder_name): | ||
""" | ||
|
Oops, something went wrong.