This commit is contained in:
annatisch 2017-05-08 09:23:41 -07:00
Родитель 34873a4e63
Коммит 9428ef3ea9
9 изменённых файлов: 85 добавлений и 245 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -227,3 +227,4 @@ packages/Newtonsoft.Json.7.0.1/lib/net45/Newtonsoft.Json.xml
packages/Newtonsoft.Json.7.0.1/lib/net40/Newtonsoft.Json.xml
packages/Newtonsoft.Json.7.0.1/lib/net35/Newtonsoft.Json.xml
packages/Newtonsoft.Json.7.0.1/lib/net20/Newtonsoft.Json.xml
.vs/config/applicationhost.config

Просмотреть файл

@ -188,6 +188,15 @@
</Content>
<Content Include="azure_batch_maya\templates\arnold-basic-windows.json" />
<Content Include="azure_batch_maya\templates\arnold-basic-linux.json" />
<Content Include="CHANGES.txt" />
<Content Include="CONTRIBUTING.md">
<SubType>Code</SubType>
</Content>
<Content Include="LICENSE.txt" />
<Content Include="README.md">
<SubType>Code</SubType>
</Content>
<Content Include="README.rst" />
<Content Include="requirements.txt">
<SubType>Code</SubType>
</Content>

Просмотреть файл

@ -1 +1 @@
v0.1.0, 2015-05-26 - Initial release.
v0.9.0 - Core re-written to use latest Azure Batch Python SDK and Batch Extensions template files.

12
CONTRIBUTING.md Normal file
Просмотреть файл

@ -0,0 +1,12 @@
Contributing Code
-----------------
This project has adopted the
[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the
[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any
additional questions or comments.
If you would like to contribute to this project, please view the
[Microsoft Contribution guidelines](https://azure.github.io/guidelines/).

Просмотреть файл

@ -1,5 +1,5 @@
The Azure Batch Maya Sample ver. 0.1.0
The Azure Batch Maya Sample ver. 0.9.0
Copyright (c) Microsoft Corporation
All rights reserved.

Двоичные данные
MayaApplicationImageSetup.pdf

Двоичный файл не отображается.

56
README.md Normal file
Просмотреть файл

@ -0,0 +1,56 @@
# Azure Batch for Maya
This project demonstrates cloud rendering using the Azure Batch service with integrated licensing for Maya and Arnold.
Please note that the Azure Batch licensing service for Maya is currently running as a gated public preview.
For more information and to register, please see [rendering.azure.com](rendering.azure.com).
In order to run this sample, you will need to [create an Azure Batch account](https://docs.microsoft.com/azure/batch/batch-account-create-portal).
You will also need a storage account. You will have the option to create a storage account as part of the Batch account setup for use as "Auto Storage".
You can use this, or you can [set up a storage account independently](https://docs.microsoft.com/azure/storage/storage-create-storage-account).
## Loading the Plug-in in Maya and Installing dependencies
Download the latest plug-in release and extract the azure_batch_maya directory to a location of your choice.
The plug-in can be run directly from the azure_batch_maya directory.
To install the plug-in:
1. Run Maya
2. Open Window > Settings/Preferences > Plug-in Manager
3. Click 'Browse'
5. Navigate to and select azure_batch_maya/plug-in/AzureBatch.py.
6. Once activated, the plug-in shelf will have appeared in the UI.
The first time the plug-in is loaded, you will be prompted to agree to some terms and conditions, and install some Python dependencies.
The downloading and installing of the Python dependencies may take a few minutes, after which you will need to close and reopen Maya to
ensure the updated dependencies are loaded correctly.
## Authentication
Before using the plug-in, it will need to be authenticated using your Azure Batch and Azure Storage account keys.
In order to retrieve this information:
1. Open the Azure management portal (ms.portal.azure.com).
2. Select Azure Batch Accounts in the left-hand menu. This can be found under "More Services" in the "Compute" category.
3. Select your account in the list. Copy and paste the account URL into "Service" field of the plug-in UI. Paste the account name into the "Batch Account" field.
4. In the portal, select "Keys" on the left-hand menu. Copy and paste one of the access keys into the "Batch Key" field in the plug-in.
5. Return to the management portal home, and select Storage Accounts from the left-hand menu. This can be found under "More Services" in the "Storage" category.
6. Select your account from the list. Copy and paste the account name into the "Storage Account" field.
7. In the portal, select "Access Keys" on the left-hand menu. Copy and paste one of the access keys into the "Storage Key" field.
8. Click "Authenticate".
## License
This project is licensed under the MIT License.
For details see LICENSE.txt or visit `opensource.org/licenses/MIT <http://opensource.org/licenses/MIT>`_.
## Contributing
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com)
with any additional questions or comments.

Просмотреть файл

@ -1,240 +0,0 @@
========================
Azure Batch Maya Sample
========================
Microsoft Azure Batch Apps is an Azure service offering on-demand capacity for compute-intensive workloads.
This sample uses the Azure Batch Apps SDK and the Azure Batch Apps Python client to show how
one could set up a cloud-based rendering platform using Maya.
The sample involves two parts, the cloud assembly project, and the Maya client project for job submission.
For more information on Batch Apps concepts, terms, and project structure `check out this article <http://azure.microsoft.com/en-us/documentation/articles/batch-dotnet-get-started/#tutorial2>`_.
The client project is a Python plug-in for Maya, to allow for a seamless user experience for submitting render
jobs to the cloud from within Maya.
The compiled components can be downloaded in the release.
License
========
This project is licensed under the MIT License.
For details see LICENSE.txt or visit `opensource.org/licenses/MIT <http://opensource.org/licenses/MIT>`_.
Set up
======
In order to build the projects you will need to have the following tools:
- `Visual Studio <http://www.visualstudio.com/>`_
- `Microsoft Azure Batch Apps Cloud SDK <http://www.nuget.org/packages/Microsoft.Azure.Batch.Apps.Cloud/>`_
- `Python Tools for Visual Studio <http://pytools.codeplex.com/>`_
- `Azure Batch Apps Python Client and it's required packages <https://github.com/Azure/azure-batch-apps-python>`_
Part 1. Maya.Cloud
======================
This project builds a cloud assembly for running rendering jobs using Maya.
A "cloud assembly" is a zip file containing an application-specific DLL with logic for splitting
jobs into tasks, and for executing each of those tasks. In this sample, we split the job into
a task for each frame to be rendered, and execute each task by running Maya's render.exe application.
The cloud assembly goes hand in hand with an "application image", a zip file
containing the program or programs to be executed. In this sample, we have used Maya and
ImageMagick in the application image.
Building the Cloud Assembly
---------------------------
To build the cloud assembly zip file:
1. Build the Maya.Cloud project.
2. Open the output folder of the Maya.Cloud project.
3. Select all the DLLs (and optionally PDB files) in the output folder.
4. Right-click and choose Send To > Compressed Folder.
Building the Application Image
-------------------------------
The application image contains the following applications:
- `Maya <http://www.autodesk.com/products/maya>`_. The application we want to cloud-enable. To run Maya on the cloud we will need
to include a number of additional components that are installed during the Maya setup process.
- `ImageMagick <http://www.imagemagick.org/script/binary-releases.php#windows>`_. (Optional) Tool for creating preview thumbnails
of the rendered frames. Locate the portable Win32 static build.
To build the application image zip file, read the included document `<MayaApplicationImageSetup.pdf>`_.
The final application image zip file should have the following structure::
Maya.zip
|
| -- AdLM
| |
| | -- ASR
| | -- R9
| | -- other AdLM components
|
| -- Common Files
| |
| | -- Autodesk Shared
|
| -- ImageMagick
| |
| | -- convert.exe
| | -- other ImageMagick components
|
| -- Maya2015
| |
| | -- bin
| | -- other Maya components
|
| -- mentalrayForMaya2015
| |
| | -- bin
| | -- other MentalRay components
Uploading the Application to Your Batch Apps Service
-----------------------------------------------------
1. Open the Azure management portal (manage.windowsazure.com).
2. Select Batch Services in the left-hand menu.
3. Select your account in the list and click "Manage Batch Apps" to open the Batch Apps management
portal. Your Batch Apps Service should be displayed, or you can navigate to it using the Services left-hand menu option.
4. Choose the Manage Applications tab.
5. Click New Application.
6. Under "Select and upload a cloud assembly", choose your cloud assembly zip file and click Upload.
7. Under "Select and upload an application image," choose your application image zip file and click Upload.
(Be sure to leave the version as "default".)
8. Click Done.
Part 2. Maya.Client
=======================
Now that the Maya rendering service is configured in Batch Apps, we need a way to submit Maya files
to be rendered.
The sample client is an Plug-in for Maya written in Python, that can be used on multiple platforms.
Python Setup
-------------
The plug-in requires some additional Python packages in order to run.
Maya is shipped with its own Python environment, so it's into this environment that these
packages will need to be installed.
There are several approaches one could take:
- Run the included dependencies.py script with mayapy.exe. This is an experimental script to conveniently
download and unpack the required modules into MAya's Python environment. To execute, run the following
command from a terminal/command line with administrator privileges::
>> mayapy.exe dependencies.py
- If there is already an installation of Python 2.7 on the machine, one can use pip to install the required
packages, choosing the Maya bundled Python environment as the target directory for the installation. Note that by
installing azure-batch-apps first, all the remaining packages will be installed automatically as dependencies::
>> pip install --target "Autodesk/Maya2015/Python/Lib/site-packages" azure-batch-apps
- Download the packages directly from `pypi.python.org <http://pypi.python.org>`_. Extract their module subfolders and copy them into the
Maya bundled Python environment::
Destination: ~/Autodesk/Maya2015/Python/Lib/site-packages
The required packages are the following:
- `Batch Apps Python Client <https://pypi.python.org/pypi/azure-batch-apps>`_
- `Keyring <https://pypi.python.org/pypi/keyring>`_
- `OAuthLib <https://pypi.python.org/pypi/oauthlib>`_
- `Requests-OAuthLib <https://pypi.python.org/pypi/requests-oauthlib>`_
- `Requests <https://pypi.python.org/pypi/requests>`_
The Maya site-packages folder should look like this when complete::
site-packages
|
| -- batchapps
| |
| | -- __init__.py
| | -- other batchapps components
|
| -- keyring
| |
| | -- __init__.py
| | -- other keyring components
|
| -- oauthlib
| |
| | -- __init__.py
| | -- other oauthlib components
|
| -- requests
| |
| | -- __init__.py
| | -- other requests components
|
| -- requests_oauthlib
| |
| | -- __init__.py
| | -- other requests_oauthlib components
|
| -- Other installed modules (e.g. pymel)
Building and Installing the Plug-in
----------------------------------
The plug-in can be run directly from the the batchapps_maya directory, which can be placed anywhere.
To install the Plug-in:
1. Run Maya
2. Open Window > Settings/Preferences > Plug-in Manager
3. Click 'Browse'
5. Navigate to and select batchapps_maya/plug-in/batchapps.py.
6. The Plug-in should be loaded automatically, you can also chose to select Auto Load for future sessions.
7. Once activated, the plug-in shelf will have appeared in the UI.
Plug-in Logging and Configuration
--------------------------------
The sample plug-in logs to both Maya's script editor and to file.
By default this log file will be saved to $HOME/BatchAppsData. This directory is also the location of the Plug-in
configuration file.
The authentication details and logging level are configurable within the Plug-in UI.
1. Run Maya.
2. Load the plug-in as per the steps above.
3. Run the plug-in by selecting the first button on the BatchApps shelf.
4. The first tab to load will be the config tab, set up your authentication details here (further instructions below).
5. Click 'Save Changes' and 'Authenticate'.
6. The plug-in is now ready to submit.
Authentication
---------------
To run this plug-in you will need:
- Your Batch Apps service URL
- Unattended account credentials for your Batch Apps service
1. Open the Azure management portal (manage.windowsazure.com).
2. Select Batch Services in the left-hand menu.
3. Select your account in the list and click "Manage Batch Apps" to open the Batch Apps management
portal. Your Batch Apps Service should be displayed, or you can navigate to it using the Services left-hand menu option.
4. Copy the service URL from the page and paste it into the 'Service' field in the Maya plug-in config tab.
5. Click the Unattended Account button at the bottom of the page.
6. Copy the Account ID from the page and paste it into the 'Unattended Account' field in the Maya plug-in config tab.
7. Below the Account Keys list, select the desired duration and click the Add Key button.
Copy the generated key and paste it into the 'Unattended Key' field in the Maya plug-in config tab.
NOTE: the generated key will be shown only once! If you accidentally close the page
before copying the key, just reopen it and add a new key.

Просмотреть файл

@ -1,3 +1,5 @@
azure-batch
azure-storage
pathlib
pathlib==1.0.1
azure-mgmt-batch==4.0.0
azure-mgmt-storage==1.0.0rc1
azure-batch==3.0.0
azure-storage==0.32.0