From 0e362bc6a7fed2fdbeb1d826d1769f43fbea64ea Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Wed, 20 Mar 2019 11:53:34 +0100 Subject: [PATCH] [dock] Import simplejson as json to make it easy to swap --- beat/core/dock.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/beat/core/dock.py b/beat/core/dock.py index 96d3dff6..78f1e23e 100644 --- a/beat/core/dock.py +++ b/beat/core/dock.py @@ -44,7 +44,7 @@ Docker helper classes import os -import simplejson +import simplejson as json import socket import tempfile import time @@ -78,7 +78,7 @@ class Host(object): self.images_cache_filename ): with open(self.images_cache_filename, "r") as f: - Host.images_cache = simplejson.load(f) + Host.images_cache = json.load(f) # Discover the environments if discover: @@ -90,7 +90,7 @@ class Host(object): # (If necessary) Save the known infos about the images if self.images_cache_filename is not None: with open(self.images_cache_filename, "w") as f: - simplejson.dump(Host.images_cache, f, indent=4) + json.dump(Host.images_cache, f, indent=4) def __contains__(self, key): return (key in self.processing_environments) or (key in self.db_environments) @@ -180,7 +180,7 @@ class Host(object): if status == 0: try: - infos = simplejson.loads(stdout) + infos = json.loads(stdout) Host.images_cache[image] = infos return infos except Exception as e: @@ -492,7 +492,7 @@ class Host(object): return None try: - return simplejson.loads(stdout)[0]["State"]["Status"] + return json.loads(stdout)[0]["State"]["Status"] except Exception: return None -- GitLab