Skip to content

Commit 6279f5e

Browse files
Ademola AdefioyeAdemola Adefioye
authored andcommitted
specifying bucketname
1 parent 01e8210 commit 6279f5e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/generate_graph.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,21 @@ def summarize_path(path: str) -> str:
181181

182182
def generate_output_path(input_path: str) -> str:
183183
"""Generates the output path for the graph JSON file."""
184-
output_dir = os.getenv("OUTPUT_DIRECTORY", "outputs")
185184

186185

187-
match = re.search(r'(?P<base>s3://[^/]+/)?(?P<project>[^/]+)/(?P<run>run-\d+-\d+)', input_path)
186+
match = re.search(r'(?P<base>s3://govuk-ai-accelerator-data-integration/)?(?P<doamin_name>[^/]+)/(?P<run>run-\d+-\d+)', input_path)
188187

189188
if match:
190189
base = match.group('base')
191-
project = match.group('project')
190+
doamin_name = match.group('doamin_name')
192191
run_id = match.group('run')
193192

194193
if base:
195194
# Dynamically use the same S3 bucket but route to graph_tools prefix
196-
return f"{base}graph_tools/{project}/{run_id}/graphNode.json"
195+
return f"{base}graph_tools/{doamin_name}/output/graphNode.json"
197196

198-
return f"{output_dir}/{project}/{run_id}/graphNode.json"
197+
else:
198+
raise ValueError(f"Input path '{input_path}' does not contain a recognizable S3 path structure.")
199199

200200
summary = summarize_path(input_path)
201201
raise ValueError(f"Input path '{summary}' does not contain a recognizable project/run structure.")

0 commit comments

Comments
 (0)