Skip to content
Closed
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
3 changes: 3 additions & 0 deletions application_sdk/activities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ async def get_workflow_args(
workflow_args["output_prefix"] = workflow_args.get(
"output_prefix", TEMPORARY_PATH
)

workflow_args["parent_run_id"] = workflow_args.get("workflow_run_id", None)

workflow_args["output_path"] = os.path.join(
workflow_args["output_prefix"], build_output_path()
)
Expand Down
6 changes: 6 additions & 0 deletions application_sdk/activities/query_extraction/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ async def fetch_queries(
)
sql_input = await sql_input.get_dataframe()

parent_run_id = workflow_args.get("parent_run_id", None)
if parent_run_id:
workflow_args["output_path"] = os.path.join(
os.path.dirname(workflow_args["output_path"]), parent_run_id
)

raw_output = ParquetOutput(
output_path=workflow_args["output_path"],
output_suffix="raw/query",
Expand Down
9 changes: 6 additions & 3 deletions application_sdk/outputs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ def path_gen(
Returns:
str: Generated file path for the chunk.
"""
# For Query Extraction - use start and end markers without chunk count
# For Query Extraction - use start and end markers
if start_marker and end_marker:
return f"{start_marker}_{end_marker}{self._EXTENSION}"
if chunk_count is None:
return f"atlan_raw_mined_{str(start_marker)}_{str(chunk_part)}{self._EXTENSION}"
else:
return f"atlan_raw_mined_{str(start_marker)}_{str(chunk_count)}_{str(chunk_part)}{self._EXTENSION}"

# For regular chunking - include chunk count
if chunk_count is None:
Expand Down Expand Up @@ -213,7 +216,7 @@ async def write_dataframe(self, dataframe: "pd.DataFrame"):
self.current_buffer_size_bytes + chunk_size_bytes
> self.max_file_size_bytes
):
output_file_name = f"{self.output_path}/{self.path_gen(self.chunk_count, self.chunk_part)}"
output_file_name = f"{self.output_path}/{self.path_gen(self.chunk_count, self.chunk_part, self.start_marker, self.end_marker)}"
if os.path.exists(output_file_name):
await self._upload_file(output_file_name)
self.chunk_part += 1
Expand Down
Loading