def get_deadline(conf_vars): """Return the deadline for the current homework""" assignment = conf_vars['assignment'] storer_config = get_unzipped_local_storer_config() storer_assignment_vars = misc.config_variables(storer_config, assignment) return storer_assignment_vars['deadline']
try: if len(files) > 0: sftp = paramiko.SFTPClient.from_transport(t) sftp_mkdir_if_not_exits(sftp, conf_vars['resultsdest']) sftp_transfer_files(sftp, files, conf_vars) sftp_transfer_penalty_output(sftp, conf_vars) except: _logger.exception('error while transferring files with paramiko') finally: t.close() def print_usage(): print 'Usage: %s config_file [files to send to storer]' % sys.argv[0] if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG) _setup_logging() if len(sys.argv) < 2: print 'No config file given' print_usage() exit(1) config_file = sys.argv[1] conf_vars = misc.config_variables(config_file, 'Assignment') # skip first two: the script name and the config file :) files = sys.argv[2:] send_results_and_notify(files, conf_vars)