mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 03:21:06 +08:00
Fixing Lint after flake upgrade (#1162)
* Fixing Lint after flake upgrade * more lint fixes
This commit is contained in:
committed by
Robert Nishihara
parent
6da7761d5d
commit
797f4fcbf3
@@ -46,8 +46,8 @@ SIMPLE_OBJECTS = (BASE_SIMPLE_OBJECTS +
|
||||
|
||||
# Create some complex objects that cannot be serialized by value in tasks.
|
||||
|
||||
l = []
|
||||
l.append(l)
|
||||
lst = []
|
||||
lst.append(lst)
|
||||
|
||||
|
||||
class Foo(object):
|
||||
@@ -55,7 +55,7 @@ class Foo(object):
|
||||
pass
|
||||
|
||||
|
||||
BASE_COMPLEX_OBJECTS = [999 * "h", 999 * u"h", l, Foo(),
|
||||
BASE_COMPLEX_OBJECTS = [999 * "h", 999 * u"h", lst, Foo(),
|
||||
10 * [10 * [10 * [1]]]]
|
||||
|
||||
LIST_COMPLEX_OBJECTS = [[obj] for obj in BASE_COMPLEX_OBJECTS]
|
||||
|
||||
@@ -33,7 +33,7 @@ def check_serializable(cls):
|
||||
.format(cls))
|
||||
try:
|
||||
obj = cls.__new__(cls)
|
||||
except:
|
||||
except Exception:
|
||||
raise RayNotDictionarySerializable("The class {} has overridden "
|
||||
"'__new__', so Ray may not be able "
|
||||
"to serialize it efficiently."
|
||||
|
||||
@@ -66,18 +66,15 @@ def address(ip_address, port):
|
||||
|
||||
|
||||
def get_ip_address(address):
|
||||
try:
|
||||
ip_address = address.split(":")[0]
|
||||
except:
|
||||
raise Exception("Unable to parse IP address from address "
|
||||
"{}".format(address))
|
||||
assert type(address) == str, "Address must be a string"
|
||||
ip_address = address.split(":")[0]
|
||||
return ip_address
|
||||
|
||||
|
||||
def get_port(address):
|
||||
try:
|
||||
port = int(address.split(":")[1])
|
||||
except:
|
||||
except Exception:
|
||||
raise Exception("Unable to parse port from address {}".format(address))
|
||||
return port
|
||||
|
||||
@@ -505,7 +502,7 @@ def start_ui(redis_address, stdout_file=None, stderr_file=None, cleanup=True):
|
||||
ui_process = subprocess.Popen(command, env=new_env,
|
||||
cwd=new_notebook_directory,
|
||||
stdout=stdout_file, stderr=stderr_file)
|
||||
except:
|
||||
except Exception:
|
||||
print("Failed to start the UI, you may need to run "
|
||||
"'pip install jupyter'.")
|
||||
else:
|
||||
|
||||
@@ -60,7 +60,7 @@ try:
|
||||
def kwargs_throw_exception(**c):
|
||||
return ()
|
||||
kwargs_exception_thrown = False
|
||||
except:
|
||||
except Exception:
|
||||
kwargs_exception_thrown = True
|
||||
|
||||
try:
|
||||
@@ -68,7 +68,7 @@ try:
|
||||
def varargs_and_kwargs_throw_exception(a, b="hi", *c):
|
||||
return "{} {} {}".format(a, b, c)
|
||||
varargs_and_kwargs_exception_thrown = False
|
||||
except:
|
||||
except Exception:
|
||||
varargs_and_kwargs_exception_thrown = True
|
||||
|
||||
# test throwing an exception
|
||||
|
||||
@@ -98,7 +98,7 @@ class Trial(object):
|
||||
self.agent.stop.remote()
|
||||
self.agent.__ray_terminate__.remote(
|
||||
self.agent._ray_actor_id.id())
|
||||
except:
|
||||
except Exception:
|
||||
print("Error stopping agent:", traceback.format_exc())
|
||||
self.status = Trial.ERROR
|
||||
finally:
|
||||
@@ -198,7 +198,7 @@ class Trial(object):
|
||||
else:
|
||||
try:
|
||||
ray.get(self.agent.restore.remote(path))
|
||||
except:
|
||||
except Exception:
|
||||
print("Error restoring agent:", traceback.format_exc())
|
||||
self.status = Trial.ERROR
|
||||
|
||||
|
||||
@@ -114,14 +114,14 @@ class TrialRunner(object):
|
||||
try:
|
||||
trial.start()
|
||||
self._running[trial.train_remote()] = trial
|
||||
except:
|
||||
except Exception:
|
||||
print("Error starting agent, retrying:", traceback.format_exc())
|
||||
time.sleep(2)
|
||||
trial.stop(error=True)
|
||||
try:
|
||||
trial.start()
|
||||
self._running[trial.train_remote()] = trial
|
||||
except:
|
||||
except Exception:
|
||||
print("Error starting agent, abort:", traceback.format_exc())
|
||||
trial.stop(error=True)
|
||||
# note that we don't return the resources, since they may
|
||||
@@ -143,7 +143,7 @@ class TrialRunner(object):
|
||||
if trial.should_checkpoint():
|
||||
trial.checkpoint()
|
||||
self._running[trial.train_remote()] = trial
|
||||
except:
|
||||
except Exception:
|
||||
print("Error processing event:", traceback.format_exc())
|
||||
if trial.status == Trial.RUNNING:
|
||||
self._stop_trial(trial, error=True)
|
||||
|
||||
@@ -1495,7 +1495,7 @@ def fetch_and_register_remote_function(key, worker=global_worker):
|
||||
|
||||
try:
|
||||
function = pickle.loads(serialized_function)
|
||||
except:
|
||||
except Exception:
|
||||
# If an exception was thrown when the remote function was imported, we
|
||||
# record the traceback and notify the scheduler of the failure.
|
||||
traceback_str = format_error_message(traceback.format_exc())
|
||||
@@ -1527,7 +1527,7 @@ def fetch_and_execute_function_to_run(key, worker=global_worker):
|
||||
function = pickle.loads(serialized_function)
|
||||
# Run the function.
|
||||
function({"counter": counter, "worker": worker})
|
||||
except:
|
||||
except Exception:
|
||||
# If an exception was thrown when the function was run, we record the
|
||||
# traceback and notify the scheduler of the failure.
|
||||
traceback_str = traceback.format_exc()
|
||||
|
||||
Reference in New Issue
Block a user