Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions libs/executors/garf/executors/entrypoints/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ def main():
)
for query in queries:
if isinstance(query, garf.executors.workflow.QueryPath):
query_path = query.full_path
if re.match(
'^(http|gs|s3|aruze|hdfs|webhdfs|ssh|scp|sftp)', query.path
'^(http|gs|s3|aruze|hdfs|webhdfs|ssh|scp|sftp)', query_path
):
batch[query.path] = reader_client.read(query.path)
batch[query.path] = reader_client.read(query_path)
else:
query_path = wf_parent / pathlib.Path(query.path)
if not query.prefix:
query_path = wf_parent / pathlib.Path(query.path)
if not query_path.exists():
raise workflow.GarfWorkflowError(
f'Query: {query_path} not found'
Expand Down
8 changes: 8 additions & 0 deletions libs/executors/garf/executors/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import os
import pathlib
import re

import pydantic
import smart_open
Expand All @@ -37,6 +38,13 @@ class QueryPath(pydantic.BaseModel):
"""Path file with query."""

path: str
prefix: str | None = None

@property
def full_path(self) -> str:
if self.prefix:
return re.sub('/$', '', self.prefix) + '/' + self.path
return self.path


class QueryDefinition(pydantic.BaseModel):
Expand Down