def test_overlapping_tag_limits(instance, grpc_server_registry):
    create_run(instance, run_id='run-1', status=PipelineRunStatus.QUEUED, tags={'foo': 'bar'})
    create_run(instance, run_id='run-2', status=PipelineRunStatus.QUEUED, tags={'foo': 'bar'})
    create_run(instance, run_id='run-3', status=PipelineRunStatus.QUEUED, tags={'foo': 'other'})
    create_run(instance, run_id='run-4', status=PipelineRunStatus.QUEUED, tags={'foo': 'other'})
    coordinator = QueuedRunCoordinatorDaemon(interval_seconds=5, max_concurrent_runs=10, tag_concurrency_limits=[{'key': 'foo', 'limit': 2}, {'key': 'foo', 'value': 'bar', 'limit': 1}])
    list(coordinator.run_iteration(instance, grpc_server_registry))
    assert (get_run_ids(instance.run_launcher.queue()) == ['run-1', 'run-3'])
def test_overlapping_tag_limits(instance, grpc_server_registry):
    create_run(instance, run_id='run-1', status=PipelineRunStatus.QUEUED, tags={'foo': 'bar'})
    create_run(instance, run_id='run-2', status=PipelineRunStatus.QUEUED, tags={'foo': 'bar'})
    create_run(instance, run_id='run-3', status=PipelineRunStatus.QUEUED, tags={'foo': 'other'})
    create_run(instance, run_id='run-4', status=PipelineRunStatus.QUEUED, tags={'foo': 'other'})
    coordinator = QueuedRunCoordinatorDaemon(interval_seconds=5, max_concurrent_runs=10, tag_concurrency_limits=[{'key': 'foo', 'limit': 2}, {'key': 'foo', 'value': 'bar', 'limit': 1}])
    list(coordinator.run_iteration(instance, grpc_server_registry))
    assert (get_run_ids(instance.run_launcher.queue()) == ['run-1', 'run-3'])