Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Moved class variable ErtServer <-> ErtClient.
Browse files Browse the repository at this point in the history
  • Loading branch information
joakim-hove committed Nov 17, 2015
1 parent c9b1fcb commit 839d974
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion devel/python/python/ert/server/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .ert_client import ErtClient
from .ert_server import ErtServer, ERROR , SUCCESS
from .ert_socket import ErtSocket
from .ert_client import ErtClient
from .run_context import RunContext
5 changes: 3 additions & 2 deletions devel/python/python/ert/server/ert_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import json
import datetime
import time
from ert.server import ErtServer

class ServerReturnedNoneException(Exception):
pass
Expand All @@ -28,6 +27,8 @@ class ConnectionErrorException(Exception):
pass

class ErtClient(object):
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'

def __init__(self , port , host):
self.socket = socket.socket( socket.AF_INET , socket.SOCK_STREAM)
self.port = port
Expand All @@ -44,7 +45,7 @@ def convert_to_datetime(data):
result = []
for d in data:
try:
result.append(datetime.datetime.strptime(d, ErtServer.DATE_FORMAT))
result.append(datetime.datetime.strptime(d, ErtClient.DATE_FORMAT))
except:
pass
return result
Expand Down
4 changes: 2 additions & 2 deletions devel/python/python/ert/server/ert_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from ert.enkf import NodeId
from ert.util import installAbortSignals

from .ert_client import ErtClient
from .run_context import RunContext

# The server will always return SUCCESS(), or alternatively raise an
Expand All @@ -49,7 +50,6 @@ def ERROR(msg , exception = None):


class ErtServer(object):
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
site_config = None

def __init__(self , config , logger=None):
Expand Down Expand Up @@ -278,6 +278,6 @@ def handleTIMESTEP(self, args):
enkf_fs_manager = self.ert_handle.getEnkfFsManager()
enkf_fs = enkf_fs_manager.getCurrentFileSystem()
time_map = enkf_fs.getTimeMap()
time_steps = [ ts.datetime().strftime(ErtServer.DATE_FORMAT) for ts in time_map ]
time_steps = [ ts.datetime().strftime(ErtClient.DATE_FORMAT) for ts in time_map ]

return self.SUCCESS(time_steps)

0 comments on commit 839d974

Please sign in to comment.