sc tbarbieri_0001p -b test_branch
Hey Tony,
BootstrappingCurrently, as I mentioned above, we have a bootstrap process that will drop users into a sub shell based on the project and "branch" the user has requested to set context to. A "project branch" is basically a fork for the project configuration and code that allows a user to run a different code base than what the "primary" branch is running. The primary branch is the default branch and is set when a branch is not specified. Project branches are mostly used for development work. Once in the sub shell, our bootstrap process has exported environment variables that can be used to query the various project attributes such as name, location, etc. It also set's up additional values in the PATH and PYTHONPATH variable. PYTHONPATH is squashed so the only path in there points to our sitecustomize.py file which will handle doing any additional bootstrapping when a python instance is initialized. We use a special environment variable PSYOP_PYTHONPATH to act as our PYTHONPATH as we want the paths set to come after the default python packages (in most situations). If we don't do this we've found python to be sluggish when importing due to stat'ing over folders on our network filesystem which can be quite slow on Windows.
Rez builds a dependency graph of “packages” based on their “requirements” and then executes commands contained within those packages in a target language/context (bash, tcsh, python, etc). A “package” can correspond with an application, library, or just a logical grouping of commands.
So, for example, you might create a base set of packages like this:
name: psyop
versions:
- master_branch
- beta_branch
commands:
# setup the base pipe env
# (can use switches based on the version, or use the version as a {variable})
name: python
version: "2.7"
variants:
- [ platform-windows ]
name: psyop_python
requires:
- psyop
- python
commands:
# set psyop-specific python env vars
name: maya
versions:
- "2014.01"
- "2014.59"
- "2015.00"
variants:
- [ platform-windows ]
requires:
- python-2.7
commands:
# set essential maya env vars like MAYA_LOCATION
name: psyop_maya
requires:
- psyop
- maya
commands:
# set psyop-specific maya env vars
name: project
version: coke
requires:
- psyop-beta_branch
- psyop_maya
- maya-2014
commands:
# setup the coke env
with this layout we could then request a shell with an env for the coke project using rez env project-coke. notice that project-coke requires both psyop_maya and a specific version of maya. That’s because pysop_maya is basically a “pass-through” package for maya which does not specify any version requirements. rez takes version requirements at all levels into consideration to find a best match, so since project-coke requires version 2014 of maya, and psyop_maya did not specify any version at all, the latest compatible version is used: 2014.59.
this might not be exactly how you want to set things up, but learning how to make granular packages was an epiphanous moment for me, so I thought I’d pass along these concepts early. the great thing about this is that you can run rez env maya to test maya without any of your studio’s changes, which is very handy for troubleshooting.
The way our bootstrap code basically works is we have some entry point bash scripts that eventually call project specific bootstrap code which offloads most of the work to python. Python then prints a bunch of bash formatted code which the bash sub shell will evaluate.
This is similar in concept to what rez env does.
Is Rez meant to fill the role our current bootstrap process?
if your bootstrap code is exporting env vars in bash based on information acquired from python, then in a lot of ways, yes. the “commands” section of each rez package is python, so it can do some pretty sophisticated things. however, you can also use rez as a python api, so your bootstrap code might use a database to find out what project a user is assigned to, etc, then correlate that info to rez packages and call rez env to setup your environment. it’s up to you to determine how much you want to do in the commands section (typically things that don’t require knowledge the “big picture”) vs outside of rez in your custom bootstrap code.
DeploymentCurrently we don't have any real deployment to speak of other than a human ssh'ing into a Linux VM and updating repositories. This was fine to get us up and running as quickly as possible but as expected it is becoming unmanageable. Some of our packages are versioned, others are not. I'd like for all of our code base to be versioned appropriately. All projects reference code from our global checkouts living on a network filesystem. I'd like for us to move to a system where each project has local checkouts of the code configured to run for them, but in order to do so we need a system to easily update the project's code base when necessary ( upgrading to newer versions, important bug fixes to existing versions, etc.). I believe this is definitely a place Rez would come into play but I'm not 100% certain how these updates would occur: pushed to each project or pulled to each project through some call to a command performed by a user. Is there a paradigm that Rez prefers? Is it typically left to a TD or developer to set context to a project and pull any updates to the local Rez config?
if i understand you correctly, this is not something that rez currently supports, though it may provide what you need in other ways. rez contains a build management tool that releases to a centralized repository. it will help you to create and maintain a sane release structure — particularly for compiled projects like OpenImageIO, OpenEXR, Alembic, etc — such that other projects can request various combinations and versions of these packages. “releasing” inevitably means divorcing source code from its git repo, even in the context of a releasing a python module using a rez wrapper around pip, for example.
both the centralization and the releasing sound like they are counter to your idea of git checkouts per project. it might be possible to extend rez for this case, if we can get a clear grasp of how it would fit into the overall ecosystem, but it might also be possible that once you understand how rez works that you can make it work for you. however, in some ways it sounds like you might want a continuous integration engine like jenkins to automate checkout and build processes after a commit is made.
ok, I’ll let you process this info for a bit.
chad.
Hello!My name is Tony Barbieri and I've been working on a Pipeline at Psyop over the last couple of years. I'm looking to overhaul (or basically implement) our deployment and build systems. Rez looks very interesting and I think would fit the bill for us. I have a few newb questions about how I should go about integrating it with what we already have. I'm also looking to jump right into the 2.0 branch as it seems like there are a lot of changes happening in there.Some details about our facilities:
- We use Shotgun and Shotgun's Toolkit framework.
- We are primarily Windows, but do have some OSX and Linux. Will most likely move more towards Linux in the future but that is very much TBD.
- Currently 90% of all of our tools are currently written in Python. The other 10% would consist of C++ projects, mostly other Open Source projects such as OpenImageIO or Arnold shaders.
- We have a "bootstrap" process that puts artists into their project context. This was all written using bash and python. Even though we are primarily Windows, we do run bash using the shell provided by Git.
- We have all of our code in various git repositories hosted internally using Gitlab.
- We are multi-office.
I suppose my first off I'm looking for suggestions about how best to begin integrating Rez, where I would start and what responsibilities Rez would have. Below I've outlined some of the components we already have in play which may help understand our current ecosystem. I apologize in advance for the large amount of detail...
BootstrappingCurrently, as I mentioned above, we have a bootstrap process that will drop users into a sub shell based on the project and "branch" the user has requested to set context to. A "project branch" is basically a fork for the project configuration and code that allows a user to run a different code base than what the "primary" branch is running. The primary branch is the default branch and is set when a branch is not specified. Project branches are mostly used for development work. Once in the sub shell, our bootstrap process has exported environment variables that can be used to query the various project attributes such as name, location, etc. It also set's up additional values in the PATH and PYTHONPATH variable. PYTHONPATH is squashed so the only path in there points to our sitecustomize.py file which will handle doing any additional bootstrapping when a python instance is initialized. We use a special environment variable PSYOP_PYTHONPATH to act as our PYTHONPATH as we want the paths set to come after the default python packages (in most situations). If we don't do this we've found python to be sluggish when importing due to stat'ing over folders on our network filesystem which can be quite slow on Windows.The way our bootstrap code basically works is we have some entry point bash scripts that eventually call project specific bootstrap code which offloads most of the work to python. Python then prints a bunch of bash formatted code which the bash sub shell will evaluate.A set context command looks like:sc tbarbieri_0001p -b test_branchMy first question is, where should Rez fit into this? Is Rez meant to fill the role our current bootstrap process? Should our bootstrap code execute a Rez command? I would imagine the second scenario as Rez will have no concept of our projects, project file system structure, etc. and we'll want to version Rez per project so updates to it won't affect projects currently in production. I imagine I will need to setup a Rez environment per project and ideally this will be automated as our project initialization code is all automated and is driven by various project management tools (Shotgun for example). So initially I assume it would use the latest global config and then get tweaked/upgraded as a project's life goes on.
DeploymentCurrently we don't have any real deployment to speak of other than a human ssh'ing into a Linux VM and updating repositories. This was fine to get us up and running as quickly as possible but as expected it is becoming unmanageable. Some of our packages are versioned, others are not. I'd like for all of our code base to be versioned appropriately. All projects reference code from our global checkouts living on a network filesystem. I'd like for us to move to a system where each project has local checkouts of the code configured to run for them, but in order to do so we need a system to easily update the project's code base when necessary ( upgrading to newer versions, important bug fixes to existing versions, etc.). I believe this is definitely a place Rez would come into play but I'm not 100% certain how these updates would occur: pushed to each project or pulled to each project through some call to a command performed by a user. Is there a paradigm that Rez prefers? Is it typically left to a TD or developer to set context to a project and pull any updates to the local Rez config?
We typically have many projects going on simultaneously so we'll need a way to manage all of these code bases easily as we have a very small development team. Any suggestions about how Rez could best be used in this situation would be much appreciated.
Application "Addons"We have written an API that manages launching and configuring applications per project. Essentially it sets up any environment variables or pre-launch configuration an application requires, allows us to set what version of software should be launched while in a project context and allows us to configure what "addons" and addon versions are loaded for that project (Maya modules, plugins, script directories, Nuke plugins, script directories, Houdini OTL's, etc.). Currently these also live in a global network location but we've been discussing "installing" them into a project and trying to find ways to minimize the number of paths required in the environment to help with application startup times. I imagine Rez could handle some of this as well, does it have any notions about how to setup an environment per application? If so, I imagine we could integrate Rez into our "launch" API rather than our current "addons" configuration manager. We've been looking to overhaul it anyhow and add proper platform support.
ToolkitShotgun's Toolkit has it's own deployment manager and configuration setup per project. This is a long shot but it could be interesting to see if Toolkit's deployment hooks could be abstracted to leverage Rez. Ideally we'll have a single API and system for managing building and deployment. It's something I could work on or bring up with the Shotgun folks as I get more comfortable with how Rez works. I'm pretty familiar with the Toolkit framework at this point and have contributed to the core so I am familiar with most of it's internals.
WindowsI started to modify some of the Rez code to get it to run under Windows using the Git Bash MSYS shell. So far I think I have it executing correctly (There will be some more areas that I'll have to mess with due to the way the different shells (MSYS, Cygwin) deal with paths and especially the PATH environment variable). Once I am more familiar about how I should go about configuring and getting Rez setup, I'll continue testing these modifications and eventually create pull requests once I'm sure I have things stable.
Again I apologize for so much detail. Hopefully understanding some of our current systems will help determine how and where Rez will fit in. Any advice or tips would be very appreciated.
Thanks for your time and for creating Rez!Best,--Tony
Hopefully you're aware of the other Windows porting efforts going on at the moment? It would probably be good to touch base with those guys and see where your efforts might overlap. Also, hopefully you've seen that shell support in Rez is plugin-based, it may make sense for you to implement an MSYS plugin, perhaps even MSYS and Cygwin that derive from some common implementation? Just food for thought.
--
You received this message because you are subscribed to the Google Groups "rez-config" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rez-config+...@googlegroups.com.
To post to this group, send email to rez-c...@googlegroups.com.
Visit this group at http://groups.google.com/group/rez-config.
For more options, visit https://groups.google.com/d/optout.