Auto selecting cluster via form.yml/form.yml.erb?

I’ve seen the multiple examples where there are cluster select options, but is there anyway to determine the cluster from system variables?

We have two separate clusters each with their own OOD and while I can see how we could add a cluster dropdown and derive values from it to have a single app, is there a way I can make that determination automatically without presenting a choice to the user?

I’m concerned giving them a choice of two clusters will cause them to think they can submit jobs to the other cluster which is not the case.

TIA!

I wonder if this would be possible by installing the cluster_name.yml files on both systems, but making the file for the other cluster unreadable. That would be a small change and enable use of the same files in all places, which might have advantages? I think that might work, but I’d really like to know!

Hi folks. Thanks for the question and response. Can you set the cluster as an environment variable? If so, you should be able to access that environment variable from submit.yml.erb and set the value for the form at that point.

Here’s a link for the env class that you will probably need to use.
https://ruby-doc.org/core-2.7.3/ENV.html

As I’m fairly new with Ruby on Rails, @jeff.ohrstrom may have a better solutions, so I’m bringing him into this conversation.

Thanks,
-gerald

That’s just fine. You’re apps can use both clusters and when they’re on cluster A the app only recognizes cluster A so it doesn’t actually show the dropdown - but will use cluster A.

OR … do you indeed have the cluster.d files for both clusters available to both instances of OOD? Simply removing the file for the inaccessible cluster and configuring your apps to use both clusters (or writing apps per cluster and deploying those apps separately - which is a lot of work).

As a question - why do you have multiple instances of OOD? Do you have separate Home directories?

Jeff,

In our case, we do have separate home directories. We actually have three different clusters, with three separate sets of filesystems for each. The data that lives on each conforms to different data use cases.

Yes the clusters are completely separate geographic locations.

Thanks for clarifying I will try that now. We only have one cluster.d file in each cluster. I was curious if the cluster: portion was even necessary when you have only one cluster defined in the configuration. We will need the if statements still for any discrepancies in the configuration.

Cool. Yea you’re basically going to have to have 2 separate apps that work on sperate clusters or 1 app that can deal with both clusters.

In terms of automatic options - there is none really. Every app has to explicitly say what cluster it’s using. The opposite is true though - if an app uses a cluster that doesn’t exist - it’ll automatically hide it as an option. Or hide the app entirely if it only uses the 1 nonexistent cluster.

Not to keep harping on this, but based on the reading of the docs, wouldn’t globbing the cluster name work (e.g. cluster: “*”)? It seems to work in my testing, but for some reason the form is cached sometimes when I try it so I can’t say for sure yet.

I’m unclear if the multiple cluster entries need to have cluster specified as a form to work.