Michael Pasternak has uploaded a new change for review. Change subject: sdk: cleanup ......................................................................
sdk: cleanup Change-Id: I3d5cf935c0474d1a10ba56d0409698989ed06d5a Signed-off-by: Michael Pasternak <[email protected]> --- M src/ovirtsdk/infrastructure/errors.py D src/ovirtsdk/infrastructure/threadpool.py 2 files changed, 0 insertions(+), 105 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/15/7215/1 diff --git a/src/ovirtsdk/infrastructure/errors.py b/src/ovirtsdk/infrastructure/errors.py index 7b7d897..860589a 100644 --- a/src/ovirtsdk/infrastructure/errors.py +++ b/src/ovirtsdk/infrastructure/errors.py @@ -20,66 +20,6 @@ def __init__(self, content): Exception.__init__(self, content) -class UnsupportedArgument(Exception): - def __init__(self, arg): - Exception.__init__(self, '[ERROR]:: Argument [%s] is NOT supported!' % arg) - -class AmbiguousParameterException(Exception): - def __init__(self, method, param): - Exception.__init__(self, '[ERROR]:: Parameter [\'-%s\'] at method [\'%s\'] is ambiguous,\nplease specify more specific path to argument or use \'root\' argumentProcessingAlgorithm!' % (param, method)) - -class ServiceMetadataEndPointLocationFailure(Exception): - def __init__(self, url): - Exception.__init__(self, '[ERROR]:: Service metadata endpoint [\'%s\'] cannot be found!' % (url)) - -class ServiceMetadataRetrievalFailure(Exception): - def __init__(self, url): - Exception.__init__(self, '[ERROR]:: Service [\'%s\'] metadata retrieval failure' % (url)) - -class AccessRuleValidation(Exception): - def __init__(self, module, fName): - Exception.__init__(self, '[ERROR]:: \'%s\' is not accessible member of \'%s\'!' % (fName, module)) - -class WrongArgumentFormat(Exception): - def __init__(self, arg): - Exception.__init__(self, '[ERROR]:: Wrong argument format [%s], argument must start with \'-\' or \'--\'!' % arg) - -class NoFurtherEntries(Exception): - def __init__(self, name): - Exception.__init__(self, "[ERROR]:: No further entries of \'%s\' can be created!" % name) - -class ServiceNotFound(Exception): - def __init__(self, name): - Exception.__init__(self, "[ERROR]:: Service not found: '%s'!" % name) - -class TypeNotFound(Exception): - def __init__(self, name): - Exception.__init__(self, "[ERROR]:: Type not found: '%s'!" % (name)) - -class NotValidArgumentForMethod(Exception): - def __init__(self, method, key): - Exception.__init__(self, '[ERROR]:: NOT valid argument \'-%s\' for method \'%s\', please review help!' % (key, method)) - -class MethodShouldHaveNoArgs(Exception): - def __init__(self, methodName, arg): - Exception.__init__(self, '[ERROR]:: Method \'%s\' should have no args, wile specified \'%s\'!' % (methodName, arg)) - -class NoArgumentsSpecified(Exception): - def __init__(self): - Exception.__init__(self, '[ERROR]:: No arguments specified!') - -class ConfigurationFileNotFound(Exception): - def __init__(self, curdir, file_path): - Exception.__init__(self, '[ERROR]:: Curr. dir. is: %s,\nConfiguration file NOT found at \'%s\' or not accessible!' % (curdir, file_path)) - -class RhevmClientHandlerInitiationTimeout(Exception): - def __init__(self, ttl): - Exception.__init__(self, '[ERROR]:: oVirt ClientHandler Initiation Timed Out [%s seconds]!' % (ttl)) - -class ExpectationError(Exception): - def __init__(self, expect): - Exception.__init__(self, '[ERROR]:: %s' % expect) - class ConnectionError(Exception): def __init__(self, expect): Exception.__init__(self, '[ERROR]::oVirt API connection failure, %s' % expect) diff --git a/src/ovirtsdk/infrastructure/threadpool.py b/src/ovirtsdk/infrastructure/threadpool.py deleted file mode 100644 index 326374e..0000000 --- a/src/ovirtsdk/infrastructure/threadpool.py +++ /dev/null @@ -1,45 +0,0 @@ -# -# Copyright (c) 2010 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from Queue import Queue -from threading import Thread - -class ThreadPool: - def __init__(self, num_threads): - self.tasks = Queue(num_threads) - for _ in range(num_threads): WorkerThread(self.tasks) - - def wait(self): - """Wait for completion of all the tasks in the queue""" - self.tasks.join() - - def add(self, func, *args, **kargs): - """Add a task to the queue""" - self.tasks.put((func, args, kargs)) - -class WorkerThread(Thread): - def __init__(self, tasks): - Thread.__init__(self) - self.tasks = tasks - self.daemon = True - self.start() - - def run(self): - while True: - func, args, kargs = self.tasks.get() - try: func(*args, **kargs) - except Exception, e: print e - self.tasks.task_done() -- To view, visit http://gerrit.ovirt.org/7215 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3d5cf935c0474d1a10ba56d0409698989ed06d5a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-sdk Gerrit-Branch: master Gerrit-Owner: Michael Pasternak <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
