Skip to content

Add functionality to easily load output files from previous executions into a running app#58

Merged
heidi-holm-4ss merged 21 commits into
mainfrom
add_load_past_output_files
Jun 10, 2025
Merged

Add functionality to easily load output files from previous executions into a running app#58
heidi-holm-4ss merged 21 commits into
mainfrom
add_load_past_output_files

Conversation

@heidi-holm-4ss
Copy link
Copy Markdown
Contributor

Add functionality for easily loading output files from previous executions into a running app. You can either download all files, or a specific file

Copy link
Copy Markdown
Contributor

@grzegorz-juras-4ss grzegorz-juras-4ss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments, there are things that are worth discussing.

Comment thread fourinsight/engineroom/utils/_core.py Outdated
def _get_all_previous_file_names(app_id, session):
"""query all available results file from the EngineRoom application. Returns list of dicts"""
response = session.get(
f"https://api.4insight.io/v1.0/Applications/{app_id}/results"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't there any config file in the package, that contain API url? I think it's a bit risky to hardcode api root url (https://api.4insight.io/) inside function definition, because it may be changed to different URL some day.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thing putting it in constants is fine for now, like it was, but the constants is not used here.

Comment thread fourinsight/engineroom/utils/_core.py Outdated
response.raise_for_status()
results = response.json()
if not results:
raise ValueError(f"No results found for application ID {app_id}.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be more user friendly to return empty list when there's no results, instead of throwing exception? For first execution of app, it'll surely fail with exception, because there are no results so far.

Comment thread tests/test_core.py
)

REMOTE_FILE_PATH = Path(__file__).parent / "testdata/a_test_file.json"
API_BASE_URL = "https://api.4insight.io"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use the constants here now too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i struggled with setting the path correctly

Copy link
Copy Markdown
Contributor

@grzegorz-juras-4ss grzegorz-juras-4ss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine now!

@heidi-holm-4ss heidi-holm-4ss merged commit cec237c into main Jun 10, 2025
9 checks passed
@heidi-holm-4ss heidi-holm-4ss deleted the add_load_past_output_files branch June 10, 2025 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Development

Successfully merging this pull request may close these issues.

3 participants