How to use the pyodm.exceptions.OdmError function in pyodm

To help you get started, we’ve selected a few pyodm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenDroneMap / ODM / opendm / remote.py View on Github external
if str(error) == "Child was terminated by signal 15":
                    system.exit_gracefully()

                task_limit_reached = isinstance(error, NodeTaskLimitReachedException)
                if task_limit_reached:
                    # Estimate the maximum number of tasks based on how many tasks
                    # are currently running
                    with calculate_task_limit_lock:
                        if nonloc.max_remote_tasks is None:
                            node_task_limit = 0
                            for t in self.params['tasks']:
                                try:
                                    info = t.info(with_output=-3)
                                    if info.status == TaskStatus.RUNNING and info.processing_time >= 0 and len(info.output) >= 3:
                                        node_task_limit += 1
                                except exceptions.OdmError:
                                    pass

                            nonloc.max_remote_tasks = max(1, node_task_limit)
                            log.ODM_INFO("LRE: Node task limit reached. Setting max remote tasks to %s" % node_task_limit)
                                

                # Retry, but only if the error is not related to a task failure
                if task.retries < task.max_retries and not isinstance(error, exceptions.TaskFailedError):
                    # Put task back in queue
                    # Don't increment the retry counter if this task simply reached the task
                    # limit count.
                    if not task_limit_reached:
                        task.retries += 1
                    task.wait_until = datetime.datetime.now() + datetime.timedelta(seconds=task.retries * task.retry_timeout)
                    cleanup_remote()
                    q.task_done()
github OpenDroneMap / WebODM / app / models / task.py View on Github external
self.pending_action = None
                        self.save()

                elif self.pending_action == pending_actions.RESTART:
                    logger.info("Restarting {}".format(self))
                    if self.processing_node:

                        # Check if the UUID is still valid, as processing nodes purge
                        # results after a set amount of time, the UUID might have been eliminated.
                        uuid_still_exists = False

                        if self.uuid:
                            try:
                                info = self.processing_node.get_task_info(self.uuid)
                                uuid_still_exists = info.uuid == self.uuid
                            except OdmError:
                                pass

                        need_to_reprocess = False

                        if uuid_still_exists:
                            # Good to go
                            try:
                                self.processing_node.restart_task(self.uuid, self.options)
                            except (NodeServerError, NodeResponseError) as e:
                                # Something went wrong
                                logger.warning("Could not restart {}, will start a new one".format(self))
                                need_to_reprocess = True
                        else:
                            need_to_reprocess = True

                        if need_to_reprocess:
github OpenDroneMap / PyODM / pyodm / exceptions.py View on Github external
class OdmError(Exception):
    """Generic catch-all exception. All exceptions in pyodm inherit from it."""
    pass

class NodeServerError(OdmError):
    """The server replied in a manner which we did not expect. Usually this indicates
    a temporary malfunction of the node."""
    pass

class NodeConnectionError(OdmError):
    """A connection problem (such as a timeout or a network error) has occurred."""
    pass

class NodeResponseError(OdmError):
    """The node responded with an error message indicating that the requested operation failed."""
    pass

class TaskFailedError(OdmError):
    """A task did not complete successfully."""
    pass

class RangeNotAvailableError(OdmError):
    """A download attempt to use Range requests failed."""
    pass
github OpenDroneMap / PyODM / pyodm / api.py View on Github external
if bytes_written != (bytes_range[1] - bytes_range[0] + 1):
                                        # Process again
                                        q.put((part_num, bytes_range))
                                        return

                                with nonloc.completed_chunks.lock:
                                    nonloc.completed_chunks.value += 1

                                    if progress_callback is not None:
                                        progress_callback(100.0 * nonloc.completed_chunks.value / num_chunks)
                            
                                nonloc.merge_chunks[part_num] = True
                            else:
                                nonloc.error = RangeNotAvailableError()
                        except OdmError as e:
                            time.sleep(5)
                            q.put((part_num, bytes_range))
                        except Exception as e:
                            nonloc.error = e
                        finally:
                            q.task_done()
github OpenDroneMap / PyODM / pyodm / exceptions.py View on Github external
class OdmError(Exception):
    """Generic catch-all exception. All exceptions in pyodm inherit from it."""
    pass

class NodeServerError(OdmError):
    """The server replied in a manner which we did not expect. Usually this indicates
    a temporary malfunction of the node."""
    pass

class NodeConnectionError(OdmError):
    """A connection problem (such as a timeout or a network error) has occurred."""
    pass

class NodeResponseError(OdmError):
    """The node responded with an error message indicating that the requested operation failed."""
    pass

class TaskFailedError(OdmError):
    """A task did not complete successfully."""
    pass

class RangeNotAvailableError(OdmError):
    """A download attempt to use Range requests failed."""
    pass
github OpenDroneMap / PyODM / pyodm / exceptions.py View on Github external
class OdmError(Exception):
    """Generic catch-all exception. All exceptions in pyodm inherit from it."""
    pass

class NodeServerError(OdmError):
    """The server replied in a manner which we did not expect. Usually this indicates
    a temporary malfunction of the node."""
    pass

class NodeConnectionError(OdmError):
    """A connection problem (such as a timeout or a network error) has occurred."""
    pass

class NodeResponseError(OdmError):
    """The node responded with an error message indicating that the requested operation failed."""
    pass

class TaskFailedError(OdmError):
    """A task did not complete successfully."""
    pass
github OpenDroneMap / PyODM / pyodm / exceptions.py View on Github external
a temporary malfunction of the node."""
    pass

class NodeConnectionError(OdmError):
    """A connection problem (such as a timeout or a network error) has occurred."""
    pass

class NodeResponseError(OdmError):
    """The node responded with an error message indicating that the requested operation failed."""
    pass

class TaskFailedError(OdmError):
    """A task did not complete successfully."""
    pass

class RangeNotAvailableError(OdmError):
    """A download attempt to use Range requests failed."""
    pass
github OpenDroneMap / PyODM / pyodm / exceptions.py View on Github external
pass

class NodeServerError(OdmError):
    """The server replied in a manner which we did not expect. Usually this indicates
    a temporary malfunction of the node."""
    pass

class NodeConnectionError(OdmError):
    """A connection problem (such as a timeout or a network error) has occurred."""
    pass

class NodeResponseError(OdmError):
    """The node responded with an error message indicating that the requested operation failed."""
    pass

class TaskFailedError(OdmError):
    """A task did not complete successfully."""
    pass

class RangeNotAvailableError(OdmError):
    """A download attempt to use Range requests failed."""
    pass
github OpenDroneMap / WebODM / nodeodm / models.py View on Github external
def auto_update_node_info(sender, instance, created, **kwargs):
    if created:
        try:
            instance.update_node_info()
        except exceptions.OdmError:
            pass