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

List/Load Projects #5

Merged
merged 2 commits into from
May 31, 2018
Merged

List/Load Projects #5

merged 2 commits into from
May 31, 2018

Conversation

tokejepsen
Copy link

@tokejepsen tokejepsen commented May 21, 2018

This PR adds the flag "ls" for listing available projects in the database:

(avalon-environment) C:\Users\admin\batman>avalon --ls
Projects in database:
['myProject', 'mySecondProject']

It also forwards CLI commands for avalon --load correctly, so you can load projects by name: avalon --load myProject.

This is related to #4

@tokejepsen tokejepsen changed the title Add "avalon --ls" command. List/Load Projects May 21, 2018
@tokejepsen
Copy link
Author

This PR is all done as far as I know, and ready to be merged.

@tokejepsen
Copy link
Author

I'm currently getting a validation warning on the schema, which I'm struggling to figure out why:

(avalon-environment) C:\Users\admin\avalon-environment>avalon
avalon.py: Forwarding 'C:\Users\admin\avalon-environment\bin\miniconda\windows\envs\avalon-environment\python.exe -u -m launcher --root C:\Users\admin\avalon-environment\bin\avalon-setup\git\avalon-examples\projects'..
Using Python @ 'C:\Users\admin\avalon-environment\bin\miniconda\windows\envs\avalon-environment\python.exe'
Using PyQt5 @ 'C:\Users\admin\avalon-environment\bin\miniconda\windows\envs\avalon-environment\lib\site-packages\PyQt5'
Using core @ 'C:\Users\admin\avalon-environment\bin\avalon-setup\git\avalon-core'
Using launcher @ 'C:\Users\admin\avalon-environment\bin\avalon-setup\git\avalon-launcher'
Using root @ 'C:\Users\admin\avalon-environment\bin\avalon-setup\git\avalon-examples\projects'
Using config: 'polly'
Starting avalon-launcher
WARNING:avalon.io:'AVALON_PROJECT' is a required property

Failed validating 'required' in schema:
    {'$schema': 'http://json-schema.org/schema#',
     'additionalProperties': True,
     'description': 'The Avalon environment',
     'properties': {'AVALON_APP': {'description': 'Name of application',
                                   'example': 'maya2016',
                                   'pattern': '^\\w*$',
                                   'type': 'string'},
                    'AVALON_ASSET': {'description': 'Name of asset',
                                     'example': 'Bruce',
                                     'pattern': '^\\w*$',
                                     'type': 'string'},
                    'AVALON_CONFIG': {'description': 'Name of Avalon '
                                                     'configuration',
                                      'example': 'polly',
                                      'pattern': '^\\w*$',
                                      'type': 'string'},
                    'AVALON_CONTAINER_ID': {'default': 'avalon.container',
                                            'description': 'Unique '
                                                           'identifier for '
                                                           'a loaded '
                                                           'representation '
                                                           'in a working '
                                                           'file',
                                            'example': 'avalon.container',
                                            'pattern': '^[\\w.]*$',
                                            'type': 'string'},
                    'AVALON_DB': {'default': 'avalon',
                                  'description': 'Name of database',
                                  'example': 'avalon',
                                  'pattern': '^\\w*$',
                                  'type': 'string'},
                    'AVALON_DEADLINE': {'default': None,
                                        'description': 'Address to '
                                                       'Deadline',
                                        'example': 'http://192.168.99.101',
                                        'pattern': '^http[\\w/@:.]*$',
                                        'type': 'string'},
                    'AVALON_DEBUG': {'default': None,
                                     'description': 'Enable debugging '
                                                    'mode. Some '
                                                    'applications may use '
                                                    'this for e.g. '
                                                    'extended verbosity or '
                                                    'mock plug-ins.',
                                     'example': 'True',
                                     'type': 'string'},
                    'AVALON_INSTANCE_ID': {'default': 'avalon.instance',
                                           'description': 'Unique '
                                                          'identifier for '
                                                          'instances in a '
                                                          'working file',
                                           'example': 'avalon.instance',
                                           'pattern': '^[\\w.]*$',
                                           'type': 'string'},
                    'AVALON_LABEL': {'default': 'Avalon',
                                     'description': 'Nice name of Avalon, '
                                                    'used in e.g. '
                                                    'graphical user '
                                                    'interfaces',
                                     'example': 'Mindbender',
                                     'type': 'string'},
                    'AVALON_MONGO': {'default': 'mongodb://localhost:27017',
                                     'description': 'Address to the asset '
                                                    'database',
                                     'example': 'mongodb://localhost:27017',
                                     'pattern': '^mongodb://[\\w/@:.]*$',
                                     'type': 'string'},
                    'AVALON_PASSWORD': {'default': 'secret',
                                        'description': 'Generic password',
                                        'example': 'abc123',
                                        'pattern': '^\\w*$',
                                        'type': 'string'},
                    'AVALON_PROJECT': {'description': 'Name of project',
                                       'example': 'Hulk',
                                       'pattern': '^\\w*$',
                                       'type': 'string'},
                    'AVALON_PROJECTS': {'description': 'Absolute path to '
                                                       'root of project '
                                                       'directories',
                                        'example': '/nas/projects',
                                        'type': 'string'},
                    'AVALON_SENTRY': {'default': None,
                                      'description': 'Address to Sentry',
                                      'example': 'https://5b872b280de742919b115bdc8da076a5:[email protected]/2',
                                      'pattern': '^http[\\w/@:.]*$',
                                      'type': 'string'},
                    'AVALON_SILO': {'description': 'Name of asset group or '
                                                   'container',
                                    'example': 'assets',
                                    'pattern': '^\\w*$',
                                    'type': 'string'},
                    'AVALON_TASK': {'description': 'Name of task',
                                    'example': 'modeling',
                                    'pattern': '^\\w*$',
                                    'type': 'string'},
                    'AVALON_TIMEOUT': {'default': '1000',
                                       'description': 'Wherever there is a '
                                                      'need for a timeout, '
                                                      'this is the default '
                                                      'value.',
                                       'example': '1000',
                                       'pattern': '^[0-9]*$',
                                       'type': 'string'},
                    'AVALON_UPLOAD': {'default': None,
                                      'description': 'Boolean of whether '
                                                     'to upload published '
                                                     'material to central '
                                                     'asset repository',
                                      'example': 'True',
                                      'type': 'string'},
                    'AVALON_USERNAME': {'default': 'avalon',
                                        'description': 'Generic username',
                                        'example': 'myself',
                                        'pattern': '^\\w*$',
                                        'type': 'string'}},
     'required': ['AVALON_PROJECTS',
                  'AVALON_PROJECT',
                  'AVALON_ASSET',
                  'AVALON_SILO',
                  'AVALON_CONFIG'],
     'title': 'avalon-core:session-1.0',
     'type': 'object'}

On instance:
    {'AVALON_CONFIG': 'polly',
     'AVALON_CONTAINER_ID': 'avalon.container',
     'AVALON_DB': 'avalon',
     'AVALON_DEBUG': 'True',
     'AVALON_INSTANCE_ID': 'avalon.instance',
     'AVALON_LABEL': 'Avalon',
     'AVALON_LOCATION': 'http://127.0.0.1',
     'AVALON_MONGO': 'mongodb://localhost:27017',
     'AVALON_PASSWORD': 'secret',
     'AVALON_PROJECTS': 'C:\\Users\\admin\\avalon-environment\\bin\\avalon-setup\\git\\avalon-examples\\projects',
     'AVALON_TIMEOUT': '1000',
     'AVALON_USERNAME': 'avalon',
     'schema': 'avalon-core:session-1.0'}
initialising..
ready
Success
avalon.py: Finishing up..

@mottosso
Copy link
Contributor

Yeah, those validation messages can get quite long.

The key is here:

WARNING:avalon.io:'AVALON_PROJECT' is a required property
``

@tokejepsen
Copy link
Author

Yeah, I can see that for some reason the AVALON_PROJECT environment variable is not being set, but there is nothing in the PR's code that deals with that, so a full stack trace of the that error/warning would be nice for debugging.

@mottosso
Copy link
Contributor

My guess is that it's happening here.

@tokejepsen
Copy link
Author

That validation is new for avalon-setup. Avalon-setup uses this io.py: https://github.com/getavalon/core/blob/ce9de34794f05359000f4c452ce47b278b56af80/avalon/io.py, in the last version. It seems because I'm upgrading avalon-core, that I suddenly see this validation warning without having dealt with the AVALON_PROJECT environment variable.

Can I ignore this?

Also its not just AVALON_PROJECT that fails the valiation. Here are the environment variables that are failing:

  • AVALON_PROJECT
  • AVALON_ASSET
  • AVALON_SILO

It seems odd to have to specify these variables when I dont have any projects in the database.

@mottosso
Copy link
Contributor

Yeah, can ignore. Need to find a better way to handle these variables missing. It's a warnings at the moment, because there's a transition being made from environment to this Session object. The goal is being able to rely on what variables are available at run-time, but this is obviously a different case to e.g. launching Maya from an existing project.

Happy to solve one problem at a time.

@tokejepsen
Copy link
Author

How do we feel about this PR then?

It'll introduce this warning, but will implement #4 .

@mottosso
Copy link
Contributor

Hm, I can't reproduce this.

$ git clone https://github.com/tokejepsen/setup.git --recursive
$ setup\avalon.bat
Using Python @ 'C:\python36\python.exe'
Using PyQt5 @ 'C:\python36\lib\site-packages\PyQt5'
Using core @ 'C:\Users\marcus\github\setup\git\avalon-core'
Using launcher @ 'C:\Users\marcus\github\setup\git\avalon-launcher'
Using root @ 'C:\Users\marcus\github\setup\git\avalon-examples\projects'
Using config: 'polly'
Starting avalon-launcher
initialising..
ready
Success

@tokejepsen
Copy link
Author

You don't seem to check out the "#4" branch?

@mottosso
Copy link
Contributor

Ahh sorry, it's on a branch. Looking now.

@mottosso
Copy link
Contributor

Checking it out gets me this commit which does contain the io.py referenced above, and removing the validation does clear the error.

So the "problem" is that you're updated avalon-core in your avalon-setup fork. The original avalon-core of avalon-setup is quite old (and stable) you can find it here (hash ce9de34) dating back to July last year. Quite a few things have happened since then.

It's a little risky to update, so before merging this it would be good if you could take it through the ropes; launch, create, publish and load. If all is OK, then it may be safe to consider it stable, though ideally I'd like it in production first.

Another option is for your --load PR to apply to the commit from avalon-setup. It'd be safer, but wouldn't advance the project.

Another option is to make a new setup distribution with bleeding edge things, to avoid requiring it to be stable. E.g. setup-dev or setup-toke.

@tokejepsen
Copy link
Author

It's a little risky to update, so before merging this it would be good if you could take it through the ropes; launch, create, publish and load. If all is OK, then it may be safe to consider it stable, though ideally I'd like it in production first.

I would certainly like to take it through the ropes, but I'm also trying to document and solve issues as I go along, so I have as newbie eyes as possible.
Production unfortunately wont be an option for me for quite some time. Will need to figure out Avalon and how to transition the existing pipelines onto Avalon.

Another option is to make a new setup distribution with bleeding edge things, to avoid requiring it to be stable. E.g. setup-dev or setup-toke.

How about maybe a "dev" branch on this repository?

It would hold the bleeding edge until tested to satisfaction. The only concern would be the amount of changes to document when merging the "dev" branch.

@mottosso
Copy link
Contributor

Ah, yes a branch is a good idea. Let's try that!

@tokejepsen
Copy link
Author

Are you able to make a "development" branch?

Should we document the changes that are different from the "master" branch somehow?

@mottosso
Copy link
Contributor

Created.

Should we document the changes that are different from the "master" branch somehow?

I think it's fairly self-explanatory. Especially if we let master remain the default branch.

@tokejepsen tokejepsen changed the base branch from master to development May 25, 2018 10:03
@tokejepsen
Copy link
Author

Have updated to merge into "development" branch.

@mottosso mottosso merged commit ab211ed into getavalon:development May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants