def main(_):
    if (not (FLAGS.workers and FLAGS.ps)):
        raise ValueError('Must provide --workers and --ps')
    workers = FLAGS.workers.split(',')
    ps = FLAGS.ps.split(',')
    cluster = {'ps': ps, 'worker': workers}
    for (task_type, jobs) in six.iteritems(cluster):
        for (idx, job) in enumerate(jobs):
            if (task_type == 'worker'):
                cmd_line_flags = ' '.join([('--master=%s' % job), ('--ps_replicas=%d' % len(ps)), ('--worker_replicas=%d' % len(workers)), '--worker_gpu=1', ('--worker_id=%d' % idx), '--ps_gpu=1', '--schedule=train', ('--sync' if (len(workers) == 1) else '')])
            else:
                cmd_line_flags = ' '.join(['--schedule=run_std_server'])
            tf_config = json.dumps({'cluster': cluster, 'task': {'type': task_type, 'index': idx}})
            print(((tf_config + '\t') + cmd_line_flags))
def main(_):
    if (not (FLAGS.workers and FLAGS.ps)):
        raise ValueError('Must provide --workers and --ps')
    workers = FLAGS.workers.split(',')
    ps = FLAGS.ps.split(',')
    cluster = {'ps': ps, 'worker': workers}
    for (task_type, jobs) in six.iteritems(cluster):
        for (idx, job) in enumerate(jobs):
            if (task_type == 'worker'):
                cmd_line_flags = ' '.join([('--master=%s' % job), ('--ps_replicas=%d' % len(ps)), ('--worker_replicas=%d' % len(workers)), '--worker_gpu=1', ('--worker_id=%d' % idx), '--ps_gpu=1', '--schedule=train', ('--sync' if (len(workers) == 1) else )])
            else:
                cmd_line_flags = ' '.join(['--schedule=run_std_server'])
            tf_config = json.dumps({'cluster': cluster, 'task': {'type': task_type, 'index': idx}})
            print(((tf_config + '\t') + cmd_line_flags))