Skip to content

Commit

Permalink
[Fixes #40] Typos on class name
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Nov 7, 2019
1 parent 9999b4c commit c8d3b4b
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 77 deletions.
6 changes: 3 additions & 3 deletions setup.py
Expand Up @@ -53,9 +53,9 @@
REQUIREMENTS = [str(r.req) for r in inst_req]

try:
readme_text = file('README.md', 'rb').read()
except IOError as e:
readme_text = open('README.md', 'rb').read()
readme_text = file('README.md', 'r').read()
except BaseException:
readme_text = open('README.md', 'r').read()

setup(
name="wps-remote",
Expand Down
4 changes: 2 additions & 2 deletions src/wpsremote/ConfigParser.py
Expand Up @@ -313,7 +313,7 @@ def read(self, filenames):
Return list of successfully read files.
"""
if isinstance(filenames, basestring):
if isinstance(filenames, str):
filenames = [filenames]
read_ok = []
for filename in filenames:
Expand Down Expand Up @@ -758,7 +758,7 @@ def set(self, section, option, value=None):
# - we do not allow valueless options, or
# - we allow valueless options but the value is not None
if self._optcre is self.OPTCRE or value:
if not isinstance(value, basestring):
if not isinstance(value, str):
raise TypeError("option values must be strings")
if value is not None:
# check for bad percent signs:
Expand Down
Expand Up @@ -11,15 +11,15 @@
__license__ = "GPL"


class BusInipendentMessage(object):
class BusIndependentMessage(object):
pass


class PresenceMessage(BusInipendentMessage):
class PresenceMessage(BusIndependentMessage):
pass


class InviteMessage(BusInipendentMessage):
class InviteMessage(BusIndependentMessage):

def __init__(self, payload, originator):
self._originator = originator
Expand All @@ -29,7 +29,7 @@ def originator(self):
return self._originator


class RegisterMessage(BusInipendentMessage):
class RegisterMessage(BusIndependentMessage):

def __init__(self, originator, service, namespace, descritpion, par, output):
self._originator = originator
Expand All @@ -46,7 +46,7 @@ def originator(self):
return self._originator


class ExecuteMessage(BusInipendentMessage):
class ExecuteMessage(BusIndependentMessage):

@staticmethod
def deserialize(filepath):
Expand Down Expand Up @@ -77,22 +77,22 @@ def serialize(self, fileptr):
pickle.dump(self, fileptr)


class ProgressMessage(BusInipendentMessage):
class ProgressMessage(BusIndependentMessage):

def __init__(self, originator, progress):
self.originator = originator
self.progress = progress


class LogMessage(BusInipendentMessage):
class LogMessage(BusIndependentMessage):

def __init__(self, originator, level, msg):
self.level = level
self.originator = originator
self.msg = msg


class CompletedMessage(BusInipendentMessage):
class CompletedMessage(BusIndependentMessage):

def __init__(self, originator, base_url, outputs):
self.originator = originator
Expand All @@ -103,29 +103,29 @@ def outputs(self):
return self._outputs


class FinishMessage(BusInipendentMessage):
class FinishMessage(BusIndependentMessage):

def __init__(self, payload, originator):
self.originator = originator
self.payload = payload


class ErrorMessage(BusInipendentMessage):
class ErrorMessage(BusIndependentMessage):

def __init__(self, originator, msg, id=None):
self.originator = originator
self.msg = msg
self.id = id


class AbortMessage(BusInipendentMessage):
class AbortMessage(BusIndependentMessage):

def __init__(self, payload, originator):
self.originator = originator
self.payload = payload


class GetLoadAverageMessage(BusInipendentMessage):
class GetLoadAverageMessage(BusIndependentMessage):

def __init__(self, payload, originator):
self._originator = originator
Expand All @@ -135,7 +135,7 @@ def originator(self):
return self._originator


class LoadAverageMessage(BusInipendentMessage):
class LoadAverageMessage(BusIndependentMessage):

def __init__(self, originator, outputs):
self.originator = originator
Expand Down
6 changes: 3 additions & 3 deletions src/wpsremote/output_file_parameter.py
Expand Up @@ -45,7 +45,7 @@ def __init__(self, par_name, d, template_vars_for_param_types=None, wps_executio

for k, v in d.items():
if hasattr(self, "_" + k):
if template_vars_for_param_types is not None and isinstance(v, basestring):
if template_vars_for_param_types is not None and isinstance(v, str):
for var, val in template_vars_for_param_types.items():
if var in v:
v = v.replace("%" + var, val)
Expand Down Expand Up @@ -168,7 +168,7 @@ def __init__(self, par_name, d, template_vars_for_param_types=None, wps_executio

for k, v in d.items():
if hasattr(self, "_" + k):
if template_vars_for_param_types is not None and isinstance(v, basestring):
if template_vars_for_param_types is not None and isinstance(v, str):
for var, val in template_vars_for_param_types.items():
if var in v:
v = v.replace("%" + var, val)
Expand Down Expand Up @@ -292,7 +292,7 @@ def __init__(

for k, v in d.items():
if hasattr(self, "_" + k):
if template_vars_for_param_types is not None and isinstance(v, basestring):
if template_vars_for_param_types is not None and isinstance(v, str):
for var, val in template_vars_for_param_types.items():
if var in v:
v = v.replace("%" + var, val)
Expand Down
14 changes: 1 addition & 13 deletions src/wpsremote/path.py
Expand Up @@ -72,18 +72,6 @@
except AttributeError:
pass

# Pre-2.3 workaround for booleans
try:
True, False
except NameError:
True, False = 1, 0

# Pre-2.3 workaround for basestring.
try:
basestring
except NameError:
basestring = (str, unicode)

# Universal newline support
_textmode = 'r'
if hasattr(file, 'newlines'):
Expand Down Expand Up @@ -117,7 +105,7 @@ def __add__(self, more):
return self.__class__(resultStr)

def __radd__(self, other):
if isinstance(other, basestring):
if isinstance(other, str):
return self.__class__(other.__add__(self))
else:
return NotImplemented
Expand Down
20 changes: 10 additions & 10 deletions src/wpsremote/processbot.py
Expand Up @@ -15,7 +15,7 @@
import base64
import sys

import busIndipendentMessages
import busIndependentMessages
import computation_job_inputs
import computational_job_input_actions
import configInstance
Expand Down Expand Up @@ -141,8 +141,8 @@ def __init__(self, remote_config_filepath, service_config_filepath, execute_mess
self._finished = False

# event handlers
self.bus.RegisterMessageCallback(busIndipendentMessages.FinishMessage, self.handle_finish)
self.bus.RegisterMessageCallback(busIndipendentMessages.AbortMessage, self.handle_abort)
self.bus.RegisterMessageCallback(busIndependentMessages.FinishMessage, self.handle_finish)
self.bus.RegisterMessageCallback(busIndependentMessages.AbortMessage, self.handle_abort)

def exit(self, return_code, exception=None):
# if exception:
Expand Down Expand Up @@ -225,7 +225,7 @@ def process_output_parser(self, invoked_process):
self.bus.xmpp.reconnect()
self.bus.xmpp.send_presence()
if self.bus.state() == 'connected':
self.bus.SendMessage(busIndipendentMessages.
self.bus.SendMessage(busIndependentMessages.
LogMessage(self._remote_wps_endpoint,
"INFO",
"start parsing stdout of created process " + self.service))
Expand Down Expand Up @@ -263,7 +263,7 @@ def process_output_parser(self, invoked_process):
" Could not send info message to GeoServer Endpoint " +
str(self._remote_wps_endpoint))
if self.bus.state() == 'connected':
self.bus.SendMessage(busIndipendentMessages.
self.bus.SendMessage(busIndependentMessages.
ProgressMessage(self._remote_wps_endpoint,
float(res.group(1).strip())))
# match = True
Expand All @@ -280,7 +280,7 @@ def process_output_parser(self, invoked_process):
" Could not send info message to GeoServer Endpoint " +
str(self._remote_wps_endpoint))
if self.bus.state() == 'connected':
self.bus.SendMessage(busIndipendentMessages.
self.bus.SendMessage(busIndependentMessages.
LogMessage(self._remote_wps_endpoint,
res.group(1).strip(),
res.group(2).strip()))
Expand All @@ -298,7 +298,7 @@ def process_output_parser(self, invoked_process):
" Could not send info message to GeoServer Endpoint " +
str(self._remote_wps_endpoint))
if self.bus.state() == 'connected':
self.bus.SendMessage(busIndipendentMessages.
self.bus.SendMessage(busIndependentMessages.
ErrorMessage(self._remote_wps_endpoint,
res.group(2).strip()))
# match = True
Expand Down Expand Up @@ -357,7 +357,7 @@ def process_output_parser(self, invoked_process):
str(self._remote_wps_endpoint))
if self.bus.state() == 'connected':
logger.info("sending 'completed' message tentative #" + str(counter))
self.bus.SendMessage(busIndipendentMessages.
self.bus.SendMessage(busIndependentMessages.
CompletedMessage(self._remote_wps_endpoint,
self._remote_wps_baseurl, outputs))
counter = counter + 1
Expand Down Expand Up @@ -411,15 +411,15 @@ def send_error_message(self, msg):
" Could not send info message to GeoServer Endpoint " +
str(self._remote_wps_endpoint))
if self.bus.state() == 'connected':
self.bus.SendMessage(busIndipendentMessages.ErrorMessage(self._remote_wps_endpoint, msg))
self.bus.SendMessage(busIndependentMessages.ErrorMessage(self._remote_wps_endpoint, msg))
else:
try:
self.bus.xmpp.reconnect()
self.bus.xmpp.send_presence()
# self.bus.xmpp.get_roster()

if self.bus.state() == 'connected':
self.bus.SendMessage(busIndipendentMessages.ErrorMessage(self._remote_wps_endpoint, msg))
self.bus.SendMessage(busIndependentMessages.ErrorMessage(self._remote_wps_endpoint, msg))
else:
sys.stdout.write("[XMPP Disconnected]: Process <UID>" +
str(self._uniqueExeId) +
Expand Down
1 change: 0 additions & 1 deletion src/wpsremote/run_threads.sh
@@ -1,2 +1 @@
python wpsagent.py -r ./xmpp_data/configs/remote.config -s ./xmpp_data/configs/myservice/service.config service &

22 changes: 11 additions & 11 deletions src/wpsremote/servicebot.py
Expand Up @@ -15,7 +15,7 @@

from collections import OrderedDict

import busIndipendentMessages
import busIndependentMessages

import configInstance
import computation_job_inputs
Expand Down Expand Up @@ -95,11 +95,11 @@ def __init__(self, remote_config_filepath, service_config_filepath):
# create the concrete bus object
self.bus = introspection.get_class_three_arg(bus_class_name, remote_config, self.service, self.namespace)

self.bus.RegisterMessageCallback(busIndipendentMessages.InviteMessage, self.handle_invite)
self.bus.RegisterMessageCallback(busIndipendentMessages.ExecuteMessage, self.handle_execute)
self.bus.RegisterMessageCallback(busIndependentMessages.InviteMessage, self.handle_invite)
self.bus.RegisterMessageCallback(busIndependentMessages.ExecuteMessage, self.handle_execute)

# -- Register here the callback to the "getloadavg" message
self.bus.RegisterMessageCallback(busIndipendentMessages.GetLoadAverageMessage, self.handle_getloadavg)
self.bus.RegisterMessageCallback(busIndependentMessages.GetLoadAverageMessage, self.handle_getloadavg)

# self._lock_running_process = thread.allocate_lock() #critical section
# to access running_process from separate threads
Expand Down Expand Up @@ -144,7 +144,7 @@ def handle_invite(self, invite_message):
self.bus.xmpp.reconnect()
self.bus.xmpp.send_presence()
self.bus.SendMessage(
busIndipendentMessages.RegisterMessage(invite_message.originator(),
busIndependentMessages.RegisterMessage(invite_message.originator(),
self.service,
self.namespace,
self.description,
Expand Down Expand Up @@ -231,7 +231,7 @@ def handle_getloadavg(self, getloadavg_message):
self.bus.xmpp.reconnect()
self.bus.xmpp.send_presence()
self.bus.SendMessage(
busIndipendentMessages.LoadAverageMessage(
busIndependentMessages.LoadAverageMessage(
getloadavg_message.originator(),
outputs
)
Expand Down Expand Up @@ -297,17 +297,17 @@ def output_parser_verbose(self, invoked_process, param_filepath):
logger.debug("gs_UID[%s] / gs_JID[%s]" % (gs_UID, gs_JID))
try:
if gs_UID and gs_JID:
self.bus.SendMessage(busIndipendentMessages.ErrorMessage(
self.bus.SendMessage(busIndependentMessages.ErrorMessage(
gs_JID, msg + " Exception: " + str(gs_MSG), gs_UID))
elif self._remote_wps_endpoint:
self.bus.SendMessage(busIndipendentMessages.ErrorMessage(self._remote_wps_endpoint, msg))
self.bus.SendMessage(busIndependentMessages.ErrorMessage(self._remote_wps_endpoint, msg))
else:
exe_msg = None
try:
logger.debug("Trying to recover Originator from Process Params!")
exe_msg = busIndipendentMessages.ExecuteMessage.deserialize(param_filepath)
exe_msg = busIndependentMessages.ExecuteMessage.deserialize(param_filepath)
if exe_msg.originator():
self.bus.SendMessage(busIndipendentMessages.
self.bus.SendMessage(busIndependentMessages.
ErrorMessage(exe_msg.originator(),
msg +
(" Exception: remote process exception. "
Expand Down Expand Up @@ -336,7 +336,7 @@ def send_error_message(self, msg):
self.bus.xmpp.reconnect()
self.bus.xmpp.send_presence()
if self._remote_wps_endpoint:
self.bus.SendMessage(busIndipendentMessages.ErrorMessage(self._remote_wps_endpoint, msg))
self.bus.SendMessage(busIndependentMessages.ErrorMessage(self._remote_wps_endpoint, msg))
else:
msg = "Process " + str(self.service) + " STALLED! Don't know who to send ERROR Message..."
logger.error(msg)
Expand Down
4 changes: 2 additions & 2 deletions src/wpsremote/wpsagent.py
Expand Up @@ -15,7 +15,7 @@
import servicebot
import processbot
import configInstance
import busIndipendentMessages
import busIndependentMessages
import resource_cleaner

__author__ = "Alessio Fabiani"
Expand Down Expand Up @@ -117,7 +117,7 @@ def __init__(self, args):
config_dir_service = path.path(args.serviceconfig).dirname()
# deserilize pickled object with process startup info to get the unique_id
# to create the sand box work dir for the process execution
self.exe_msg = busIndipendentMessages.ExecuteMessage.deserialize(args.params)
self.exe_msg = busIndependentMessages.ExecuteMessage.deserialize(args.params)

# read the service config file with interpolation=true (raw=False) to get
# the proper sand box work dir using the unique id as input parameter
Expand Down

0 comments on commit c8d3b4b

Please sign in to comment.