예제 #1
0
def as_awkward(o: ObjectStream) -> ak.JaggedArray:
    '''Return a query as a pandas dataframe.

    Args:
        o (ObjectStream): The query

    Returns:
        pd.DataFrame: The result
    '''
    return load_root_as_awkward(o.value())
예제 #2
0
def as_pandas(o: ObjectStream) -> pd.DataFrame:
    '''Return a query as a pandas dataframe.

    Args:
        o (ObjectStream): The query

    Returns:
        pd.DataFrame: The result
    '''
    return load_root_as_pandas(o.value())
예제 #3
0
def test_eds_recovery_two_ds():
    r1 = my_event()
    r2 = my_event()

    q1 = r1.Select(lambda a: a + 1)
    q2 = r2.Select(lambda b: b + 1)

    q = ObjectStream(ast.BinOp(q1.query_ast, ast.Add, q2.query_ast))
    with pytest.raises(Exception) as e:
        find_EventDataset(q.query_ast)

    assert "more than one" in str(e)
예제 #4
0
파일: sx_qastle.py 프로젝트: uccross/coffea
def sx_event_stream(did: str, query: ObjectStream):
    """Fetch the data from the queue and return an async stream
    of the results (minio urls)

    Args:
        did ([type]): Dataset identifier
        query ([type]): The actual query, as an ObjectStream

    Returns:
        An async generator that can be processed with the `aiostream` library
        or an `async for` python pattern.
    """
    sx = ServiceXDataset(did, backend_type="xaod")
    return sx.get_data_rootfiles_minio_async(query.value())
예제 #5
0
def test_eds_recovery_no_root():
    q = ObjectStream(ast.BinOp(ast.Num(1), ast.Add, ast.Num(2)))
    with pytest.raises(Exception) as e:
        find_EventDataset(q.query_ast)

    assert "no root" in str(e)