Features:
Command line
python batch.py --help
Multiple Worker Processes through multibatch module
Cross-platform support (Haven't tested on Mac or Linux yet but it *should* work.)
Tested on systems with Maya 2012 and 2013
Extensible through actions modules
Command Line Single Process Example:
python batch.py --queue file01.ma file02.ma file03.ma file03.ma --modules mayabatch.actions.actionA mayabatch.actions.actionB
Python Multiprocessing Example:
import os
import mayabatch.multibatch as mb
if __name__ == '__main__':
path = 'C:/Users/Administrator/Documents/maya/projects/default/'
filepaths = []
for root, subdirs, files in os.walk(path):
for f in files:
if os.path.splitext(f)[-1] in ['.ma', '.mb']:
filepaths.append(os.path.join(root, f))
modules = ['mayabatch.actions.actionA', 'mayabatch.actions.actionB']
processes = 4
mb.main(filepaths, processes, modules)
A simple benchmark produced the following results:
50 maya files
4 processes: 10.433 seconds
1 process: 8.145 seconds
350 maya files
4 processes: 15.353 seconds
1 processes: 26.932 seconds
As you can see it's a balancing act between the amount of processes and files. These tests were run on a system where maya's usersetup script is far from ideal for batch processing.
Notes
At the moment filepaths for each individual file are placed in the command line. Depending on the complexity of the paths the maximum length of args in a windows command prompt can be reached quickly. Pickling will be introduced into the mix to work around the command line args limit.
Get it from github: https://github.com/danbradham/mayabatch
No comments:
Post a Comment