This commit is contained in:
annatisch 2017-10-05 13:27:12 -07:00
Родитель c6022b9a14
Коммит e712e453c3
21 изменённых файлов: 151 добавлений и 35 удалений

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

@ -1,9 +1,33 @@
2017-08-?? v0.11.0
(unreleased) v0.15.0
--------------------
- Updated dependencies azure-batch (4.0.0) and azure-batch-extensions (1.0.0)
- Better support for unicode
2017-09-26 v0.14.0
------------------
- Support for Maya2017 Update4 and tentatively for Maya2018
- Fix for crash when "threads" option is missing from config .ini file
- Various test and .sln level fixes
2017-09-14 v0.13.0
------------------
- Fix incorrect dependency install type for concurrent.futures
2017-09-10 v0.12.0
------------------
- VRay Preview support in license picker for pools, Batch accounts will require whitelisting
2017-09-07 v0.11.0
------------------
- Support for V-ray for Maya
- Dependency on new Batch Extensions module
- Fixed asset file limitation
2017-07-05 v0.10.0
------------------
- Exposed low priority VM allocation for pools

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

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

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

@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from __future__ import unicode_literals
import os
import sys
import gzip
@ -15,6 +17,11 @@ import maya.OpenMayaMPx as omp
from default import AzureBatchRenderJob, AzureBatchRenderAssets
try:
str = unicode
except NameError:
pass
class ArnoldRenderJob(AzureBatchRenderJob):

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

@ -3,10 +3,17 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from __future__ import unicode_literals
import os
from maya import cmds, mel
try:
str = unicode
except NameError:
pass
class AzureBatchRenderJob(object):

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

@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from __future__ import unicode_literals
import os
import sys
import gzip
@ -12,6 +14,11 @@ from maya import cmds, mel
from default import AzureBatchRenderJob, AzureBatchRenderAssets
try:
str = unicode
except NameError:
pass
class AzureBatchMayaJob(AzureBatchRenderJob):

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

@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from __future__ import unicode_literals
from maya import mel, cmds
import maya.OpenMaya as om
import maya.OpenMayaMPx as omp
@ -15,6 +17,11 @@ import tempfile
from default import AzureBatchRenderJob, AzureBatchRenderAssets
try:
str = unicode
except NameError:
pass
class VrayRenderJob(AzureBatchRenderJob):

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

@ -33,21 +33,20 @@ INSTALL_DIR = os.path.normpath(
sys.path.append(INSTALL_DIR)
REQUIREMENTS = {
"pathlib==1.0.1": "pathlib",
"futures==3.1.1": "concurrent.futures",
"msrestazure==0.4.11": "msrestazure",
"azure-common==1.1.8": "azure.common",
"futures==3.1.1": "concurrent.futures",
}
NAMESPACE_PACKAGES = {
"azure-mgmt-batch==4.0.0": "azure.mgmt.batch",
"azure-mgmt-storage==1.0.0": "azure.mgmt.storage",
"azure-batch==3.0.0": "azure.batch",
"azure-batch==4.0.0": "azure.batch",
"azure-storage==0.32.0": "azure.storage",
"azure-batch-extensions==0.2.0": "azure.batch_extensions",
"azure-batch-extensions==1.0.0": "azure.batch_extensions"
}
VERSION = "0.13.0"
VERSION = "0.15.0"
EULA_PREF = "AzureBatch_EULA"
SHELF_FILE = "shelf_AzureBatch.mel"
cmd_name = "AzureBatch"

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

@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from __future__ import unicode_literals
import logging
from datetime import datetime
import threading
@ -13,7 +15,7 @@ import pkgutil
import inspect
import importlib
import tempfile
import pathlib
import re
from Queue import Queue
from azure.batch_extensions import _file_utils as fileutils
@ -32,6 +34,10 @@ from default import AzureBatchRenderAssets
SYS_SEARCHPATHS = []
USR_SEARCHPATHS = []
BYTES = 1024
try:
str = unicode
except NameError:
pass
class AzureBatchAssets(object):
@ -108,7 +114,7 @@ class AzureBatchAssets(object):
scene = os.path.abspath(maya.file(q=True, sn=True))
if ((scene.endswith('.mb')) or (scene.endswith('.ma'))) and (os.path.exists(scene)):
SYS_SEARCHPATHS.append(os.path.dirname(scene))
proj = maya.workspace(query=True, rootDirectory=True)
proj = utils.get_root_dir()
SYS_SEARCHPATHS.append(proj)
SYS_SEARCHPATHS.append(os.path.join(proj, "sourceimages"))
SYS_SEARCHPATHS.append(maya.workspace(query=True, directory=True))
@ -166,7 +172,8 @@ class AzureBatchAssets(object):
full_remote_path = "X:\\\\" + remote_path
else:
full_remote_path = "/X/" + remote_path
handle.write("workspace -fr \"{}\" \"{}\";\n".format(rule, full_remote_path))
mapped_dir = "workspace -fr \"{}\" \"{}\";\n".format(rule, full_remote_path)
handle.write(mapped_dir.encode('utf-8'))
return Asset(proj_file, [], self.batch, self._log)
def _create_path_map(self, plugins, os_flavor):
@ -188,7 +195,7 @@ class AzureBatchAssets(object):
handle.write("{\n")
if plugins:
for plugin in plugins:
handle.write("loadPlugin \"{}\";\n".format(plugin))
handle.write("loadPlugin \"{}\";\n".format(plugin.encode('utf-8')))
handle.write("dirmap -en true;\n")
for local, remote in pathmap.items():
if os_flavor == utils.OperatingSystem.windows:
@ -196,7 +203,8 @@ class AzureBatchAssets(object):
else:
full_remote_path = "/X/" + remote(os_flavor)
parsed_local = local.replace('\\', '\\\\')
handle.write("dirmap -m \"{}\" \"{}\";\n".format(parsed_local, full_remote_path))
map_cmd = "dirmap -m \"{}\" \"{}\";\n".format(parsed_local, full_remote_path)
handle.write(map_cmd.encode('utf-8'))
handle.write("}")
return Asset(map_file, [], self.batch, self._log)
@ -283,7 +291,12 @@ class AzureBatchAssets(object):
group.
"""
project_path = maya.workspace(query=True, fullName=True)
return project_path.split('/')[-1]
name = project_path.split('/')[-1]
# Make lower case
name = name.lower()
# Remove any chars that aren't 'a-z', '0-9' or '-'
name = re.sub(r'\W+', '', name)
return name
def get_assets(self):
"""Returns the current asset references for display. Called by the UI
@ -373,6 +386,8 @@ class AzureBatchAssets(object):
finally:
# If part of job submission, errors and progress bar
# will be handled back in submission.py
for index, asset in enumerate(asset_refs):
asset.restore_label()
if not job_set:
progress_bar.end()
self.ui.upload_button.finish()
@ -561,7 +576,9 @@ class Asset(object):
def __init__(self, filepath, parent, batch, log=None):
self.batch = batch
self.path = os.path.normpath(filepath)
if not os.path.isabs(filepath):
filepath = os.path.join(utils.get_root_dir(), filepath)
self.path = os.path.realpath(os.path.normpath(filepath))
self.label = " {0}".format(os.path.basename(self.path))
self.exists = os.path.exists(self.path)
self.lastmodified = datetime.fromtimestamp(os.path.getmtime(self.path)) if self.exists else None
@ -648,12 +665,22 @@ class Asset(object):
"""Check whether this file is already represented in the current
asset list.
"""
return any(pathlib.Path(f.path) == pathlib.Path(self.path) for f in files)
for file_ref in files:
try:
if os.path.samefile(file_ref.path, self.path):
return True
except OSError:
this_path = self.path.lower() if utils.is_windows() else self.path
ref_path = file_ref.path.lower() if utils.is_windows() else file_ref.path
if this_path == ref_path:
return True
return False
def restore_label(self):
"""Restore the original UI display label after the file has been
uploaded.
"""
if self.display_text:
maya.text(self.display_text, edit=True, label=self.label)
def make_visible(self, index):
@ -711,8 +738,8 @@ class Asset(object):
self.display_text, edit=True,
label=" Uploading 100% {0}".format(name)))
queue.put(maya.refresh)
finally:
self.log.debug("Finished asset upload: {}".format(self.path))
queue.put(self.restore_label)
queue.put(self.size)

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

@ -4,11 +4,9 @@
# --------------------------------------------------------------------------------------------
try:
print "Importing maya"
from maya import cmds, mel, utils
import maya.OpenMaya as om
import maya.OpenMayaMPx as omp
print "Imported maya"
except ImportError:
print("No maya module found.")
import os

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

@ -7,7 +7,6 @@ from enum import Enum
import os
import logging
import platform
import pathlib
from azurebatchmayaapi import MayaAPI as maya
from exception import CancellationException, FileUploadException
@ -96,6 +95,21 @@ def get_os():
return platform.system()
def is_windows():
"""Check whether Maya is currently running
on Windows.
:returns: bool.
"""
return get_os() == 'Windows'
def get_root_dir():
"""Get the project root directory - by default relative paths in Maya
should be relative to this directory.
"""
return maya.workspace(query=True, rootDirectory=True)
class OperatingSystem(Enum):
windows = 'Windows'
linux = 'Linux'
@ -458,7 +472,7 @@ class JobWatcher(object):
maya.warning("Existing process running with current job ID. "
"Job watching already in action.")
except Exception as e:
maya.warning(e)
maya.warning(str(e))
def check_existing_process(self):
"""Check whether a job watcher for the specified job is already running.
@ -494,8 +508,8 @@ class JobWatcher(object):
"""
prepared_args = []
for arg in args:
arg = os.path.normpath(arg).replace('\\', '\\\\')
prepared_args.append(self.quotes + str(arg) + self.quotes)
arg = os.path.normpath(arg).replace('\\', '\\\\').encode('utf-8')
prepared_args.append(self.quotes + arg + self.quotes)
self._log.debug("Cleaned up commandline arguments: {0}, {1}, "
"{2}, {3}, {4}".format(*prepared_args))
return prepared_args

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

@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from __future__ import unicode_literals
import os
import logging
import json

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

@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from __future__ import unicode_literals
import os
import logging
import tempfile

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

@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from __future__ import unicode_literals
import os
import logging
import uuid
@ -15,7 +17,6 @@ from azurebatchmayaapi import MayaAPI as maya
from ui_pools import PoolsUI
class AzureBatchPools(object):
"""Handler for pool functionality."""

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

@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from __future__ import unicode_literals
import os
import sys
import pkgutil

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

@ -4,6 +4,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from __future__ import unicode_literals
import webbrowser
import ConfigParser
import time
@ -12,6 +14,10 @@ import os
import re
import threading
try:
str = unicode
except NameError:
pass
batch_client = None
storage_client = None
header_line_length = 50
@ -151,15 +157,16 @@ def _authenticate(cfg_path):
if __name__ == "__main__":
try:
sys.path.append(sys.argv[4])
print("Appending path {0}".format(sys.argv[4]))
lib_path = sys.argv[4].decode('utf-8')
sys.path.append(lib_path)
print("Appending path {0}".format(lib_path))
import azure.storage.blob as storage
import azure.batch_extensions as batch
from azure.batch.batch_auth import SharedKeyCredentials
data_path = sys.argv[1]
data_path = sys.argv[1].decode('utf-8')
job_id = sys.argv[2]
download_dir = sys.argv[3]
download_dir = sys.argv[3].decode('utf-8')
_check_valid_dir(download_dir)
_authenticate(data_path)

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

@ -163,7 +163,7 @@ class EnvironmentUI(object):
self.env_vars, cellIndex=(row, 1), query=True, cellValue=True)
row_val = maya.table(
self.env_vars, cellIndex=(row, 2), query=True, cellValue=True)
vars[str(row_key[0])] = str(row_val[0])
vars[row_key[0]] = row_val[0]
return vars
def use_license_server(self, enabled):

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

@ -126,6 +126,10 @@
"name": "MAYA_SCRIPT_PATH",
"value": "/mnt/resource/batch/tasks/workitems/[parameters('outputs')]/job-1/jobpreparation/wd/scripts"
},
{
"name": "LANG",
"value": "en_US.iso88591"
},
{
"name": "FLEXLM_TIMEOUT",
"value": "5000000"

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

@ -119,6 +119,10 @@
"name": "MAYA_SCRIPT_PATH",
"value": "/mnt/resource/batch/tasks/workitems/[parameters('outputs')]/job-1/jobpreparation/wd/scripts"
},
{
"name": "LANG",
"value": "en_US.iso88591"
},
{
"name": "FLEXLM_TIMEOUT",
"value": "5000000"

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

@ -119,6 +119,10 @@
"name": "MAYA_SCRIPT_PATH",
"value": "/mnt/resource/batch/tasks/workitems/[parameters('outputs')]/job-1/jobpreparation/wd/scripts"
},
{
"name": "LANG",
"value": "en_US.iso88591"
},
{
"name": "FLEXLM_TIMEOUT",
"value": "5000000"

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

@ -32,7 +32,7 @@ import subprocess
import shutil
import zipfile
VERSION = "0.14.0"
VERSION = "0.15.0"
def main():
"""Build Maya Plug-in package"""

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

@ -1,7 +1,7 @@
pathlib==1.0.1
futures==3.1.1
azure-mgmt-batch==4.0.0
azure-mgmt-storage==1.0.0rc1
azure-batch==3.0.0
azure-batch-extensions==0.2.0
azure-batch==4.0.0
azure-batch-extensions==1.0.0
azure-storage==0.32.0
mock==2.0.0