-
Notifications
You must be signed in to change notification settings - Fork 86
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
Ordering/selection for display purposes of Resources attached to Allocation #334
Comments
I agree with the problems detailed in this issue. It's been an annoyance that I have not yet bothered to document so I appreciate this! It would be convenient to be able to select the order displayed and not just count on alphabetical order. |
My immediate issue was that I was planning to grant PIs allocations with
compute and 2 storage tiers as resources; with some PIs getting multiple
allocations with different compute resources but same storage resources,
and the displayed Resource was always one of the storage resources, which
made things hard to understand. My issue was resolved with the patch I
submitted, setting the ordering to use '-is_allocatable',
'resource_type__name' to force the Cluster/ClusterPartition Resource to get
chosen preferentially to the Storage Resources.
While the above met my immediate needs, I can see a desire for a more
general solution. But I am not sure if it should be for arbitrary ranking
of Resources, or if it should just be by ResourceTypes. If by
ResourceType, I think that would require adding a ranking field in
ResourceType model. For arbitrary ranking by Resource, this could possibly
be via ResourceAttributes (but I have some concern re performance when the
ordering of Resources depends on lookups from a Many2Many field) or by
adding a ranking field in Resource model. I am not sure what other sites
are doing with ColdFront and whether arbitrary ordering of Resources is
needed/worth adding a field to ResourceType or Resource models.
…On Wed, Nov 10, 2021 at 1:46 PM Dori Sajdak ***@***.***> wrote:
I agree with the problems detailed in this issue. It's been an annoyance
that I have not yet bothered to document so I appreciate this! It would be
convenient to be able to select the order displayed and not just count on
alphabetical order.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#334 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AETE577U5FST6IG7AP3G6YLULK4V5ANCNFSM5HYTMX7Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
Tom Payerle
DIT-ACIGS/Mid-Atlantic Crossroads ***@***.***
5825 University Research Park (301) 405-6135
University of Maryland
College Park, MD 20740-3831
|
Fixed in #335 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If one has an allocation with multiple resources attached, there currently does not appear to be any way to control which Resource is used as the "parent" Resource or the ordering of the Resources for display purposes.
E.g., when listing the Allocations for a Project (ie the $WEBROOT/project/$PROJECT_ID page), the allocations will be shown with a Resource name and type, but this can be any of the Resources attached to the Allocation and it does not appear easy to control. It looks to me like this is controlled by Allocation.get_parent_resource, which seems to order the Resources by 'name' (from the Resource Meta subclass) and then filter out any which are not allocatable.
This means that the only means to control which Resource is picked up by the parent is by carefully choosing Resource names so that the desired Resource to be used is always alphabetically first, which is onerous.
(It also means that for the abnormal case wherein an Allocation has multiple Resources attached and none of the Resources are allocatable, exceptions will be raised in the web pages whenever trying to display that Allocation. While this admittedly is a problematic situation for other reasons, it should not cause exceptions to be raised just to display things)
Also, the get_resources_as_string appears to order things somewhat differently (i.e. is uses order_by '-is_allocatable', so allocatable
Resources come first, but any ordering among Resources with the same allocatability is up to the DB???), so that the first Resource in the get_resources_as_string() list is not necessarily the get_parent_resource().
Ideally, there would be some way to associate a priority to each Resource so one could force ResourceA to always come before/ be preferred as the get_parent_resource over ResourceB whenever both are in the list of Resources for an Allocation. The natural way would be with a ResourceAttribute, but I am not sure if the overhead of doing attribute lookups that frequently would be worthwhile.
As a simpler first step, I propose that a new setting ALLOCATION_RESOURCE_ORDERING be added, and that this value be used by both get_parent_resource() and get_resources_as_string() for ordering the Resources attached to an Allocation. The default value can be [ '-is_allocatable', 'name' ] which would mostly reproduce the existing behavior (it would make the two methods consistent, and because they previously were not necessarily consistent, there will some existing behavior which is not reproduced). It also will handle the admittedly abnormal case wherein an Allocation has multiple Resources attached which are all non-allocatable. A PR is forthcoming.
The text was updated successfully, but these errors were encountered: