Skip to content

Commit dc4e46c

Browse files
authored
Merge pull request #101 from mitdbg/main
fix BACKEND_ROOT and remove code
2 parents 8fc888b + 906edc7 commit dc4e46c

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

app/backend/app/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
FILESYSTEM = "file" if IS_LOCAL_ENV else "s3"
55
REGION_NAME = os.getenv("AWS_REGION", "us-east-1")
66
COMPANY_ENV = os.getenv("COMPANY_ENV", "dev")
7-
BACKEND_ROOT = "/code/backend/"
7+
BACKEND_ROOT = "/code/"
88
BASE_DIR = f"s3://carnot-research-{COMPANY_ENV}/"
99
DATA_DIR = f"s3://carnot-research-{COMPANY_ENV}/data/"
1010
SHARED_DATA_DIR = f"s3://carnot-research-{COMPANY_ENV}/shared/"

app/backend/app/routes/query.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,12 @@ def run_query_with_capture():
314314

315315
# If we found a filename, check if that file exists and use it
316316
if csv_filename_from_output:
317-
actual_csv_path = os.path.join(BACKEND_ROOT, csv_filename_from_output)
318-
if os.path.exists(actual_csv_path) and actual_csv_path != csv_path:
317+
actual_csv_path = Path(BACKEND_ROOT) / csv_filename_from_output
318+
if actual_csv_path.exists() and actual_csv_path != csv_path:
319319
# Use the file that Carnot created
320320
csv_filename = csv_filename_from_output
321321
csv_path = actual_csv_path
322-
df = pd.read_csv(csv_path) # Re-read from the actual file
323-
else:
324-
# File doesn't exist, rename our file to match
325-
csv_path.rename(actual_csv_path)
326-
csv_path = actual_csv_path
327-
csv_filename = csv_filename_from_output
322+
df = pd.read_csv(str(csv_path)) # Re-read from the actual file
328323

329324
if df.empty:
330325
message_text = "No results found for your query."

src/carnot/core/data/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
IS_LOCAL_ENV = os.getenv("LOCAL_ENV").lower() == "true"
2525
FILESYSTEM = "file" if IS_LOCAL_ENV else "s3"
2626
COMPANY_ENV = os.getenv("COMPANY_ENV", "dev")
27-
BACKEND_ROOT = "/code/backend/"
27+
BACKEND_ROOT = "/code/"
2828
BASE_DIR = f"s3://carnot-research-{COMPANY_ENV}/"
2929
DATA_DIR = f"s3://carnot-research-{COMPANY_ENV}/data/"
3030
SHARED_DATA_DIR = f"s3://carnot-research-{COMPANY_ENV}/shared/"

0 commit comments

Comments
 (0)