import wizard
from wizard import deploy, util, shell, sset, command
-from wizard.command import migrate
def main(argv, baton):
options, args = parse_args(argv, baton)
app = args[0]
base_args = calculate_base_args(options)
- sh = make_shell(options)
- seen = make_serialized_set(options)
+ sh = shell.ParallelShell.make(options.no_parallelize, options.max)
+ seen = sset.make(options)
is_root = not os.getuid()
warnings_log, errors_log = open_aggregate_logs(options)
# loop stuff
default=False, help="Turn off parallelization")
parser.add_option("--dry-run", dest="dry_run", action="store_true",
default=False, help="Print commands that would be run. Implies --no-parallelize")
- parser.add_option("--max", dest="max",
+ parser.add_option("--max", dest="max", type="int",
default=10, help="Maximum subprocesses to run concurrently")
parser.add_option("--force", dest="force", action="store_true",
default=False, help="Force migrations to occur even if .scripts or .git exists.")
def calculate_log_name(i, dir):
return "%04d" % i + dir.replace('/', '-') + ".log"
-def make_shell(options):
- if options.no_parallelize:
- return shell.DummyParallelShell()
- else:
- return shell.ParallelShell(max=int(options.max))
-
-def make_serialized_set(options):
- if options.seen:
- return sset.SerializedSet(options.seen)
- else:
- return sset.DummySerializedSet()
except deploy.NotMigratedError:
pass
except (deploy.CorruptedAutoinstallError, AlreadyMigratedError):
- if options.force:
- perform_force(options)
- else:
+ if not options.force:
raise
deployment.verifyTag(options.srv_path)
elif e.errno == errno.EACCES:
raise command.PermissionsError(dir)
raise
+ if options.force: perform_force(options)
make_repository(sh, options, repo, tag)
check_variables(deployment, options)
finally:
super(ParallelShell, self).__init__(dry=dry)
self.running = {}
self.max = max # maximum of commands to run in parallel
+ @staticmethod
+ def make(self, no_parallelize, max):
+ """Convenience method oriented towards command modules."""
+ if no_parallelize:
+ return DummyParallelShell()
+ else:
+ return ParallelShell(max=max)
def _async(self, proc, args, python, on_success, on_error, **kwargs):
"""
Gets handed a :class:`subprocess.Proc` object from our deferred