Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store aggregated results in separate folder #683

Merged
merged 6 commits into from
Oct 25, 2024

Conversation

OVI3D0
Copy link
Member

@OVI3D0 OVI3D0 commented Oct 16, 2024

Description

Changes OSB's file storage so that aggregated test results are stored in their own folder, aggregated_results alongside the test_executions folder.

Issues Resolved

#661

Testing

  • New functionality includes testing

make it + make test


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

doc = test_execution.as_dict()
aggregated_execution_path = paths.aggregated_results_root(self.cfg, test_execution_id=test_execution.test_execution_id)
io.ensure_dir(aggregated_execution_path)
aggregated_file = os.path.join(aggregated_execution_path, "test_execution.json")
Copy link
Collaborator

Choose a reason for hiding this comment

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

May be better to call this aggregated_test_execution.json.

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

Copy link
Member Author

Choose a reason for hiding this comment

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

@gkamat @IanHoang done + I added some changes to metrics.py so OSB can locate the new aggregate folder if you guys wouldn't mind taking a look👍

@OVI3D0 OVI3D0 force-pushed the aggregate-folder branch 2 times, most recently from db9dcf3 to 20d6048 Compare October 23, 2024 19:35
@OVI3D0 OVI3D0 requested a review from gkamat October 23, 2024 21:33
Copy link
Collaborator

@IanHoang IanHoang left a comment

Choose a reason for hiding this comment

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

Left a couple suggestions

Comment on lines 1319 to 1324
def format_dict(d):
if d:
items = sorted(d.items())
return ", ".join(["%s=%s" % (k, v) for k, v in items])
else:
return None
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should avoid repeating helper functions. This already exists in the list_test_executions() function. It'd be better to move it out of both so that both can use it

Comment on lines 1326 to 1356
aggregated_test_executions = []
for test_execution in test_execution_store(cfg).list_aggregations():
aggregated_test_executions.append([
test_execution.test_execution_id,
time.to_iso8601(test_execution.test_execution_timestamp),
test_execution.workload,
format_dict(test_execution.workload_params),
test_execution.test_procedure_name,
test_execution.provision_config_instance_name,
format_dict(test_execution.user_tags),
test_execution.workload_revision,
test_execution.provision_config_revision])

if len(aggregated_test_executions) > 0:
console.println("\nRecent aggregated test executions:\n")
console.println(tabulate.tabulate(
aggregated_test_executions,
headers=[
"TestExecution ID",
"TestExecution Timestamp",
"Workload",
"Workload Parameters",
"TestProcedure",
"ProvisionConfigInstance",
"User Tags",
"workload Revision",
"Provision Config Revision"
]))
else:
console.println("")
console.println("No recent aggregate tests found.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This works but a lot of this is duplicated from list_test_executions(). How do you feel about creating a separate helper method and just passing in the methods like the following pseudo code"

def list_test_executions(cfg):
    list_test_helper(test_execution_store(cfg).list_aggregations(), "test executions")

def list_aggregated_test_results(cfg):
    list_test_helper(test_execution_store(cfg).list_aggregations(), "aggregation tests")

def list_test_helper(test_store_method, test_execution_type):
    def format_dict(d):
        if d:
            items = sorted(d.items())
            return ", ".join(["%s=%s" % (k, v) for k, v in items])
        else:
            return None
    
    test_executions = []
    listed_test_executions = test_store_method
    for test_execution in listed_test_executions:
        ...
    console.println(f"No recent {test_execution_type} found.")
     ...

By putting boiler plate code in list_test_helper(), we will avoid repeating code and slim down both list_test_executions(cfg) and list_aggregated_test_results(cfg).

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point! Did this

@@ -697,6 +698,8 @@ def dispatch_list(cfg):
test_execution_orchestrator.list_pipelines()
elif what == "test_executions":
metrics.list_test_executions(cfg)
elif what == "aggregated_results":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you've introduced a new method called list_aggregations(), how do you feel about using aggregations here as opposed to aggregated_results? Aggregations would be more simple for users to type out. But on second thought, aggregations might be confused with OpenSearch aggregations. I'm open to either

Copy link
Member Author

Choose a reason for hiding this comment

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

Personally, I think aggregated_results is more explicit and clear about what it's referring to. But we could make it so either aggregations or aggregated_results triggers the same function maybe?

Copy link
Collaborator

Choose a reason for hiding this comment

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

aggregated_results is more explicit and we can go forth with that

@OVI3D0 OVI3D0 requested a review from IanHoang October 24, 2024 22:34
@@ -1275,7 +1275,7 @@ def results_store(cfg):
return NoopResultsStore()


def list_test_executions(cfg):
def list_test_helper(store, title):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: store_item might be more apt.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done👍

@IanHoang IanHoang merged commit bf1debc into opensearch-project:main Oct 25, 2024
10 checks passed
@OVI3D0 OVI3D0 deleted the aggregate-folder branch October 28, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants