core icon indicating copy to clipboard operation
core copied to clipboard

The AVALON_APP variable does not tell what application was launched

Open BigRoy opened this issue 8 years ago • 14 comments

Issue

The AVALON_APP variable refers to what? Currently it is the active application directory.

  • It is not the application name in the database. (e.g. {"name": "maya2018"})
  • It is not the name of the .toml triggered. (e.g. maya2018.toml)
  • It is not the name of the host (e.g. host maya)

Nevertheless the application directory does not allow to reproduce exactly which application you launched into which could be helpful to reproduce the environment required for that application.

Should we also store which application was actually launched, that would be the maya2018 name instead of the application folder. Or is that information redundant?

Use case: Reproduce environment elsewhere.

When submitting to (for example) Deadline it could be useful to explicitly state which application environment to load up for the slave to start. This could mean loading up the relevant application .toml and sending along that enviroment as opposed to the local user's environment.

The alternative to that is to allow the Deadline submission to always parse a mayabatch.toml configured for that particular project - which has the benefit to being even more explicit on how it will end up being loaded though it will have to be managed separately from the maya.toml then.

BigRoy avatar Nov 29 '17 08:11 BigRoy

To further add to the current confusion. The launcher does this:

  1. First it stores the application name in the AVALON_APP variable, here.
  2. Then it overwrites this with the application directory here and here.

Resulting in it first being maya2018 briefly and then become maya just before it launches the app.

BigRoy avatar Nov 29 '17 10:11 BigRoy

Are you sure it's the folder? And not the definition you have in your configuration?

https://getavalon.github.io/2.0/reference/#project-configuration-api

mottosso avatar Nov 29 '17 10:11 mottosso

Ah, ok, then that sounds like a bug. It should be this definition, which makes it reproducible and exact.

mottosso avatar Nov 29 '17 10:11 mottosso

Ah, yes - but then the AVALON_APP can't be used when formatting paths - e.g. the work directory; we'd need a different variable for that. :)

BigRoy avatar Nov 29 '17 10:11 BigRoy

Hm, no I think that's fine. It'd just be maya2018/ in that case, or whatever you call the app in the configuration.

mottosso avatar Nov 29 '17 10:11 mottosso

Hm, no I think that's fine. It'd just be maya2018/ in that case, or whatever you call the app in the configuration.

In that case the configuration's "application_dir" is irrelevant?

To me running both Maya2018 and Maya2016 should be fine to run within the same folder (e.g. maya), so the application directory was convenient to some extent.

BigRoy avatar Nov 29 '17 11:11 BigRoy

Possibly; it's either that, or we hand application_dir to the path formatting thingy

mottosso avatar Nov 29 '17 11:11 mottosso

Yes, maybe AVALON_APPDIR though that would be consufing with AVALON_WORKDIR where work directory is a full path? But I think AVALON_APPDIR could be a way moving into the right direction.

BigRoy avatar Nov 29 '17 11:11 BigRoy

APPDIR sounds good, or APPDIRNAME. Too long. What about removing app dir? Maybe it's been overengineered at the moment. Using AVALON_APP, then each available app would have its own folder. Sounds intuitive to me. And most projects will have one primary Maya, and then that app could be called simply "maya", whereas other versions get a version number.

mottosso avatar Nov 29 '17 11:11 mottosso

My preference is to be able to still set an application directory:

To me running both Maya2018 and Maya2016 should be fine to run within the same folder (e.g. maya), so the application directory was convenient to some extent.

BigRoy avatar Nov 29 '17 12:11 BigRoy

I think you can still do that, apps in the config can have the same name I think.

mottosso avatar Nov 29 '17 13:11 mottosso

They could have different arguments, and label, for example.

mottosso avatar Nov 29 '17 13:11 mottosso

With this PR https://github.com/getavalon/core/pull/306 merged an application launched through the new actions using the Application class would also have AVALON_APP_NAME. Seems to have sneaked in.

It's putting that into the environment that it's building.

As such, in the application you should be able to find:

  • AVALON_APP: the current application directory (as defined as application_dir in the app's .toml
  • AVALON_APP_NAME: the application's name (that's the name of the loaded .toml - which is the also the name in the database, because that's used to search for a similarly named .toml)

So the information is now available, yet the names might still be confusing.

@mkolar what's your view on this?

BigRoy avatar Feb 28 '18 14:02 BigRoy

Reading through the discussion I'm leaning on the side of storing full path to the work directory as AVALON_WORKDIR or something similar and application's name as AVALON_APP (the name doesn't matter really.)

Purely a personal feeling that the full path will be more useful than application_dir from the app's .toml

At least AVALON_WORKDIR would then be useful also in setups where studio doesn't use application directories in the path (like us for instance :) )

mkolar avatar Mar 01 '18 00:03 mkolar