Esempio n. 1
0
def test_first(node1, node2, default_config):
    manager = Manager(bbox=Bbox.from_nodes(node_left_down=node1,
                                           node_right_up=node2),
                      configuration=default_config)
    manager._generate_small_bboxes()
    assert manager.small_bboxes[0].left == node1.longitude
    assert manager.small_bboxes[0].bottom == node1.latitude
def test_manager_standalone(store_path):
    small_bbox = Bbox(left=8.83848086, bottom=47.2218996495, right=8.8388215005, top=47.2220713398)
    manager = Manager(bbox=small_bbox, standalone=True, configuration=Configuration(dict(bbox_size=50, compare=False)))
    manager.run()
    with open(store_path, 'r') as f:
        data = json.load(f)
    assert len(data['nodes']) == 1
def test_with_three(node1, configuration_no_compare):
    node2 = node1.add_meter(2 * configuration_no_compare.bbox_size + 50, 2 * configuration_no_compare.bbox_size + 50)
    manager = Manager(bbox=Bbox.from_nodes(node_left_down=node1, node_right_up=node2))
    columns = manager._calc_columns()
    rows = manager._calc_rows()
    assert rows == 3
    assert columns == 3
Esempio n. 4
0
def test_with_two_columns(node1):
    node2 = node1.add_meter(200, Manager.small_bbox_side_length + 50)
    manager = Manager(bbox=Bbox.from_leftdown_rightup(node1, node2),
                      job_queue_name='dummy')
    columns = manager._calc_columns()
    rows = manager._calc_rows()
    assert rows == 1
    assert columns == 2
Esempio n. 5
0
def test_with_two_columns(node1, configuration_no_compare):
    node2 = node1.add_meter(200, configuration_no_compare.bbox_size + 50)
    manager = Manager(
        bbox=Bbox.from_nodes(node_left_down=node1, node_right_up=node2))
    columns = manager._calc_columns()
    rows = manager._calc_rows()
    assert rows == 1
    assert columns == 2
def test_big_bbox(node1, node2):
    manager = Manager(bbox=Bbox.from_nodes(node_left_down=node1, node_right_up=node2))
    length = len(manager.small_bboxes)
    manager._generate_small_bboxes()
    assert manager.small_bboxes[0].left == node1.longitude
    assert manager.small_bboxes[0].bottom == node1.latitude
    assert (manager.small_bboxes[length - 1].right >= node2.longitude
            and manager.small_bboxes[length - 1].right <= node2.longitude + 0.05)
    assert (manager.small_bboxes[length - 1].top >= node2.latitude
            and manager.small_bboxes[length - 1].top <= node2.latitude + 0.05)
Esempio n. 7
0
def test_with_three(node1, configuration_no_compare):
    bbox_size = int(configuration_no_compare.JOB.bboxsize)
    node2 = node1.add_meter(2 * bbox_size + 50, 2 * bbox_size + 50)
    manager = Manager(bbox=Bbox.from_nodes(node_left_down=node1,
                                           node_right_up=node2),
                      configuration=configuration_no_compare)
    columns = manager._calc_columns()
    rows = manager._calc_rows()
    assert rows == 3
    assert columns == 3
Esempio n. 8
0
def test_big_bbox(node1, node2):
    manager = Manager(
        bbox=Bbox.from_nodes(node_left_down=node1, node_right_up=node2))
    length = len(manager.small_bboxes)
    manager._generate_small_bboxes()
    assert manager.small_bboxes[0].left == node1.longitude
    assert manager.small_bboxes[0].bottom == node1.latitude
    assert (manager.small_bboxes[length - 1].right >= node2.longitude and
            manager.small_bboxes[length - 1].right <= node2.longitude + 0.05)
    assert (manager.small_bboxes[length - 1].top >= node2.latitude
            and manager.small_bboxes[length - 1].top <= node2.latitude + 0.05)
Esempio n. 9
0
def test_big_bbox(node1, node2):
    manager = Manager(bbox=Bbox.from_leftdown_rightup(node1, node2),
                      job_queue_name='dummy')
    length = len(manager.small_bboxes)
    manager._generate_small_bboxes()
    assert manager.small_bboxes[0].left == node1.longitude
    assert manager.small_bboxes[0].bottom == node1.latitude
    assert (manager.small_bboxes[length - 1].right >= node2.longitude and
            manager.small_bboxes[length - 1].right <= node2.longitude + 0.05)
    assert (manager.small_bboxes[length - 1].top >= node2.latitude
            and manager.small_bboxes[length - 1].top <= node2.latitude + 0.05)
Esempio n. 10
0
def manager(args, configuration):
    big_bbox = Bbox(left=args.bb_left, bottom=args.bb_bottom, right=args.bb_right, top=args.bb_top)
    try:
        print('Manager has started...')
        manage = Manager(bbox=big_bbox, configuration=configuration, standalone=args.standalone)
        manage.run()
    except ConnectionError:
        print(
            'Failed to connect to redis instance [{ip}:{port}], is it running? Check connection arguments and retry.'.format(
                ip=configuration.REDIS.server,
                port=configuration.REDIS.port))
    finally:
        print('Manager has finished!')
Esempio n. 11
0
def manager(args, configuration):
    big_bbox = Bbox(left=args.bb_left, bottom=args.bb_bottom, right=args.bb_right, top=args.bb_top)
    try:
        print('Manager has started...')
        manage = Manager(big_bbox, 'jobs', configuration, args.standalone)
        manage.run()
    except ConnectionError:
        print(
            'Failed to connect to redis instance [{ip}:{port}], is it running? Check connection arguments and retry.'.format(
                ip=configuration.server,
                port=configuration.port))
    finally:
        print('Manager has finished!')
Esempio n. 12
0
def test_manager_standalone(store_path):
    small_bbox = Bbox(left=8.83848086,
                      bottom=47.2218996495,
                      right=8.8388215005,
                      top=47.2220713398)
    manager = Manager(bbox=small_bbox,
                      standalone=True,
                      configuration=Configuration(
                          dict(bbox_size=50, compare=False)))
    manager.run()
    with open(store_path, 'r') as f:
        data = json.load(f)
    assert len(data['nodes']) == 1
Esempio n. 13
0
def test_manager_standalone(store_path, configuration_no_compare):
    small_bbox = Bbox(left=9.351172,
                      bottom=47.098195,
                      right=9.351301,
                      top=47.098480)
    configuration_no_compare.DETECTION.bboxsize = 50
    manager = Manager(bbox=small_bbox,
                      standalone=True,
                      configuration=configuration_no_compare)

    manager.run()
    with open(store_path, 'r') as f:
        data = json.load(f)
    assert len(data['nodes']) == 1
Esempio n. 14
0
def manager(args):
    big_bbox = Bbox.from_lbrt(args.bb_left, args.bb_bottom, args.bb_right,
                              args.bb_top)
    try:
        print('Manger has started...')
        search = Search(word=args.search,
                        key=args.tag[0],
                        value=args.tag[1],
                        zoom_level=int(args.zoom_level),
                        compare=(not args.no_compare),
                        orthofoto=args.orthofoto)
        Manager.from_big_bbox(big_bbox, redis_args(args),
                              args.redis_jobqueue_name, search)
    except ConnectionError:
        print(
            'Failed to connect to redis instance [{ip}:{port}], is it running? Check connection arguments and retry.'
            .format(ip=args.redis_host, port=args.redis_port))
    finally:
        print('Manager has finished!')
def test(big_bbox):
    manager = Manager(bbox=big_bbox)
    columns = manager._calc_columns()
    rows = manager._calc_rows()
    assert rows > 40
    assert columns > 2
def test_first(node1, node2):
    manager = Manager(bbox=Bbox.from_nodes(node_left_down=node1, node_right_up=node2))
    manager._generate_small_bboxes()
    assert manager.small_bboxes[0].left == node1.longitude
    assert manager.small_bboxes[0].bottom == node1.latitude
Esempio n. 17
0
def test(big_bbox):
    manager = Manager(bbox=big_bbox)
    columns = manager._calc_columns()
    rows = manager._calc_rows()
    assert rows > 40
    assert columns > 2
Esempio n. 18
0
def test(big_bbox, default_config):
    manager = Manager(bbox=big_bbox, configuration=default_config)
    columns = manager._calc_columns()
    rows = manager._calc_rows()
    assert rows > 40
    assert columns > 2
Esempio n. 19
0
def test_manager_configuration(big_bbox):
    manager = Manager(bbox=big_bbox)
    assert manager.configuration is not None
Esempio n. 20
0
def test(big_bbox):
    manager = Manager(bbox=big_bbox, job_queue_name='dummy')
    columns = manager._calc_columns()
    rows = manager._calc_rows()
    assert rows > 40
    assert columns > 2
Esempio n. 21
0
def test_first(node1, node2):
    manager = Manager(bbox=Bbox.from_leftdown_rightup(node1, node2),
                      job_queue_name='dummy')
    manager._generate_small_bboxes()
    assert manager.small_bboxes[0].left == node1.longitude
    assert manager.small_bboxes[0].bottom == node1.latitude