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

Adding a ct.get_all_results() function #1701

Open
Andrew-S-Rosen opened this issue Jun 14, 2023 · 9 comments · May be fixed by #1840
Open

Adding a ct.get_all_results() function #1701

Andrew-S-Rosen opened this issue Jun 14, 2023 · 9 comments · May be fixed by #1840
Labels
feature New feature addition good first issue Good for newcomers hacktoberfest Part of Hacktoberfest help wanted Looking for help or input from external contributors priority / low Not currently a priority

Comments

@Andrew-S-Rosen
Copy link
Contributor

Andrew-S-Rosen commented Jun 14, 2023

What should we add?

There is currently a ct.get_result(<dispatch ID>) function, which works perfectly. It would be even more awesome if there were an option to do ct.get_all_results() that would automatically return all results!

The "manual" way I'd come up with is something like this (it's a bit messy but you get the idea):

config_results_dir = ct.get_config()["dispatcher"]["results_dir"]
dispatch_ids = os.listdir(config_results_dir)
# ^ hmm.... guess this relies on you being on the same machine (how else to get all dispatch IDs?)

# Populate the docs
docs = []
for d_id in dispatch_ids:
    try:
        result_obj = ct.get_result(d_id)
    except MissingLatticeRecordError:
        continue
    if result_obj and result_obj.status == "COMPLETED": # the "COMPLETED" check could be optional
        docs.append({"dispatch_id": d_id, "result": result_obj})
return docs

I'm not sure if there is a more efficient way. Of course, I'm happy to open a PR based on this if what I've proposed is the optimal route.

Describe alternatives you've considered.

Looping, like above! :)

@Andrew-S-Rosen Andrew-S-Rosen added the feature New feature addition label Jun 14, 2023
@santoshkumarradha
Copy link
Member

@arosen93 , thanks again ! this is a nice feature. Could you also add a bit more about the UX of how one might want to deal with if its a large graph and the objects are significant as well? Maybe it returns a generator instead of list ?

@Andrew-S-Rosen
Copy link
Contributor Author

That's a great question! Yes, I think a generator would probably be the ideal solution for this problem.

@santoshkumarradha santoshkumarradha added good first issue Good for newcomers help wanted Looking for help or input from external contributors labels Jul 24, 2023
@wjcunningham7
Copy link
Member

As a part of this issue, we want to be able to filter by a list of dispatch IDs and statuses. Additionally include fields such as started_before, started_after, completed_before, and completed_after.

@wjcunningham7 wjcunningham7 added the hacktoberfest Part of Hacktoberfest label Sep 23, 2023
@wjcunningham7
Copy link
Member

This issue is a part of Hacktoberfest. Closing this issue will earn you 2 points.

@akash47angadi
Copy link

In which folder is the above function located?

@Aady7
Copy link

Aady7 commented Oct 11, 2023

Would like to work on the issue

@Andrew-S-Rosen
Copy link
Contributor Author

@Ceres445
Copy link

Are there any alternative ways to get the list of dispatch ids?

@Smartmind12 Smartmind12 linked a pull request Oct 23, 2023 that will close this issue
3 tasks
@jimmylism jimmylism added the priority / low Not currently a priority label Dec 15, 2023
@adirao-projects
Copy link

adirao-projects commented Jan 7, 2024

I've added a pull request (#1901) with the the desired implementation. I think everything checks out but if any changes are required I can make them. If @Andrew-S-Rosen or @wjcunningham7 could take a look (or anyone else) and let me know if I need to fix anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature addition good first issue Good for newcomers hacktoberfest Part of Hacktoberfest help wanted Looking for help or input from external contributors priority / low Not currently a priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants