X-Git-Url: https://scripts.mit.edu/gitweb/wizard.git/blobdiff_plain/28836cbeccf3aaed1619415eb025d75c02b387f2..4d911a9cb1eccf1520a53efc3499cdd3a63b2fbc:/wizard/command/mass_migrate.py diff --git a/wizard/command/mass_migrate.py b/wizard/command/mass_migrate.py index 278c5e6..2007430 100644 --- a/wizard/command/mass_migrate.py +++ b/wizard/command/mass_migrate.py @@ -16,9 +16,10 @@ def main(argv, baton): app = args[0] base_args = calculate_base_args(options) sh = shell.ParallelShell.make(options.no_parallelize, options.max_processes) + command.create_logdir(options.log_dir) seen = sset.make(options.seen) is_root = not os.getuid() - warnings_log, errors_log = command.open_logs(options.log_dir) + report = command.open_reports(options.log_dir) # loop stuff errors = {} i = 0 @@ -34,14 +35,14 @@ def main(argv, baton): child_args = list(base_args) # calculate the log file, if a log dir was specified if options.log_dir: - log_file = command.calculate_log_name(options.log_dir, i, d.location) + log_file = command.calculate_log_name(options.log_dir, i) child_args.append("--log-file=" + log_file) # actual meat def make_on_pair(d, i): # we need to make another stack frame so that d and i get specific bindings. def on_success(stdout, stderr): if stderr: - warnings_log.write("%s\n" % d.location) + report.warnings.write("%s\n" % d.location) logging.warning("Warnings [%04d] %s:\n%s" % (i, d.location, stderr)) seen.add(d.location) def on_error(e): @@ -54,7 +55,7 @@ def main(argv, baton): if name not in errors: errors[name] = [] errors[name].append(d) logging.error("%s in [%04d] %s" % (name, i, d.location)) - errors_log.write("%s\n" % d.location) + report.errors.write("%s\n" % d.location) return (on_success, on_error) on_success, on_error = make_on_pair(d, i) sh.call("wizard", "migrate", d.location, *child_args,