How to use pyodm - 10 common examples

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 / WebODM / nodeodm / tests.py View on Github external
pass

                time.sleep(0.5)
                retries += 1
                if retries >= num_retries:
                    self.assertTrue(False, error_description)
                    return False

        api = Node("localhost", 11224, "test_token")
        online_node = ProcessingNode.objects.get(pk=3)

        self.assertTrue(online_node.update_node_info(), "Could update info")

        # Cannot call info(), options()  without tokens
        api.token = "invalid"
        self.assertRaises(NodeResponseError, api.info)
        self.assertRaises(NodeResponseError, api.options)

        # Cannot call create_task() without token
        import glob
        self.assertRaises(NodeResponseError, api.create_task, glob.glob("nodeodm/fixtures/test_images/*.JPG"))

        # Can call create_task() with token
        api.token = "test_token"
        res = api.create_task(
            glob.glob("nodeodm/fixtures/test_images/*.JPG"))
        uuid = res.uuid
        self.assertTrue(uuid != None)

        # Can call task_info() with token
        task_info = api.get_task(uuid).info()
        self.assertTrue(isinstance(task_info.date_created, datetime))
github OpenDroneMap / WebODM / nodeodm / tests.py View on Github external
def test_offline_api(self):
        api = Node("offline-host", 3000)
        self.assertRaises(NodeConnectionError, api.info)
        self.assertRaises(NodeConnectionError, api.options)
github OpenDroneMap / WebODM / nodeodm / tests.py View on Github external
def test_offline_api(self):
        api = Node("offline-host", 3000)
        self.assertRaises(NodeConnectionError, api.info)
        self.assertRaises(NodeConnectionError, api.options)
github OpenDroneMap / ODM / tests / test_remote.py View on Github external
done()
                    except Exception as e:
                        done(e)

                t = threading.Thread(target=monitor)
                self.params['threads'].append(t)
                t.start()

        self.lre.run(TaskMock)
        self.assertTrue(nonloc.local_task_check)

        nonloc.should_fail = True
        nonloc.remote_queue = 1
        nonloc.task_limit_reached = False

        with self.assertRaises(exceptions.TaskFailedError):
            self.lre.run(TaskMock)
github OpenDroneMap / ODM / tests / test_remote.py View on Github external
def info(self):
                class StatusMock:
                    status = TaskStatus.RUNNING if self.running else TaskStatus.QUEUED
                    processing_time = 1
                return StatusMock()
github OpenDroneMap / WebODM / nodeodm / tests.py View on Github external
retries = 0
            while True:
                try:
                    task_info = api.get_task(uuid).info()
                    if task_info.status.value == status:
                        return True
                except (NodeResponseError, NodeServerError):
                    pass

                time.sleep(0.5)
                retries += 1
                if retries >= num_retries:
                    self.assertTrue(False, error_description)
                    return False

        api = Node("localhost", 11224, "test_token")
        online_node = ProcessingNode.objects.get(pk=3)

        self.assertTrue(online_node.update_node_info(), "Could update info")

        # Cannot call info(), options()  without tokens
        api.token = "invalid"
        self.assertRaises(NodeResponseError, api.info)
        self.assertRaises(NodeResponseError, api.options)

        # Cannot call create_task() without token
        import glob
        self.assertRaises(NodeResponseError, api.create_task, glob.glob("nodeodm/fixtures/test_images/*.JPG"))

        # Can call create_task() with token
        api.token = "test_token"
        res = api.create_task(
github OpenDroneMap / WebODM / nodeodm / tests.py View on Github external
def setUp(self):
        self.api_client = Node("localhost", 11223)
github OpenDroneMap / WebODM / nodeodm / tests.py View on Github external
retries = 0
            while True:
                try:
                    task_info = api.get_task(uuid).info()
                    if task_info.status.value == status:
                        return True
                except (NodeServerError, NodeResponseError):
                    pass

                time.sleep(0.5)
                retries += 1
                if retries >= num_retries:
                    self.assertTrue(False, error_description)
                    return False

        api = Node("localhost", 11223)
        online_node = ProcessingNode.objects.get(pk=1)

        # Can call info(), options()
        self.assertTrue(type(api.info().version) == str)
        self.assertTrue(len(api.options()) > 0)
        
        # Can call new_task()
        import glob
        res = api.create_task(
                glob.glob("nodeodm/fixtures/test_images/*.JPG"), 
                {'force-ccd': 6.16},
                "test")
        uuid = res.uuid
        self.assertTrue(uuid != None)

        # Can call task_info()
github OpenDroneMap / WebODM / nodeodm / tests.py View on Github external
def test_offline_api(self):
        api = Node("offline-host", 3000)
        self.assertRaises(NodeConnectionError, api.info)
        self.assertRaises(NodeConnectionError, api.options)
github OpenDroneMap / WebODM / nodeodm / tests.py View on Github external
self.assertTrue(online_node.cancel_task(uuid))
        self.assertRaises(NodeResponseError, online_node.cancel_task, "wrong-uuid")

        # Wait for task to be canceled
        wait_for_status(api, uuid, status_codes.CANCELED, 5, "Could not remove task")
        self.assertTrue(online_node.remove_task(uuid))
        self.assertRaises(NodeResponseError, online_node.remove_task, "wrong-uuid")

        # Cannot delete task again
        self.assertRaises(NodeResponseError, online_node.remove_task, uuid)

        # Task has been deleted
        self.assertRaises(NodeResponseError, online_node.get_task_info, uuid)

        # Test URL building for HTTPS
        sslApi = Node("localhost", 443, 'abc')
        self.assertEqual(sslApi.url('/info'), 'https://localhost/info?token=abc')