Instead of using a hardcoded one, how can I retrieved the current cluster used in the form ? This will allows me to have a generic application form while having different queue definitions per cluster.
I’m not sure this can be done without introducing a dropdown for the user to select which cluster to use. As far as I know the form.yml.erb is not cluster-aware — though with OOD, there are often undocumented behaviors, so it’s hard to say definitively.
One possible workaround might involve using an environment variable (e.g., ENV['OOD_CLUSTER']) and calling OodAppkit.clusters[ENV['OOD_CLUSTER'].to_sym] to retrieve the appropriate cluster config. But this requires coordination from the sysadmin side to ensure that variable is always correctly set, which may not be simpler than just specifying the cluster statically in the form.
In short, there’s no built-in API in OOD to automatically detect or dynamically select the current cluster within the form that I know of. Any dynamic behavior would need to be implemented manually, likely scripting and environment variables, and even then it’s unclear how reliable or maintainable that approach would be.
As always, it could be there’s a way here that is just not documented or known, but I am unsure myself.
Thanks Travis for your answer. I’m trying to isolate the application form from the cluster definition and want to inject enhanced attribute to the default partition names.
The fact is that when there are multiple clusters, a dropdown is automatically added by OOD, so maybe the way I’m doing it is not the right one. At the GOOD conference there were some examples presented with initializers and plugins, I may investigate that path too.
If someone else has an example to share on how to dynamically query partitions other than autoqueues, I will be pleased to try.
That reminds me to update that portion of the tutorial to include the ondemand.d configuration for global_bc_form_items.
I think you could use either, but ondemand.d configuration may be cleaner.
In any case, I think the resolution is simple - you create a list of all the queues on all clusters, then attach dynamic data- directives to it so they’ll be able to show and hide themselves based on the current choice of cluster.
Technically they’ll be there in the HTML, but the user won’t see them in the dropdown given the rules you apply to them.