Esempio n. 1
0
            for ip in public_addresses(r_from):
                commands.append(
                    f'({SSH} {args.user}@{ip} "echo \\"{script}\\" > netem.sh && chmod +x netem.sh") & '
                )

        for r, script in preview:
            print("**************************")
            print(f"   Script for region {r}  ")
            print("**************************")
            print(script)
            print()

        if not args.dry_run:
            os.system(''.join(commands) + ' wait')


if __name__ == "__main__":
    start_time = time.time()
    initialize_and_run_commands("Controls deployment and experiment of SLOG", [
        BenchmarkCommand,
        CollectClientCommand,
        CollectServerCommand,
        GenDataCommand,
        StartCommand,
        StopCommand,
        StatusCommand,
        LogsCommand,
        LocalCommand,
        GenNetEmCommand,
    ])
    LOG.info("Elapsed time: %.1f sec", time.time() - start_time)
Esempio n. 2
0
File: aws.py Progetto: ctring/SLOG
                for r in instances['Reservations']:
                    for i in r['Instances']:
                        info.append([
                            i.get('PublicIpAddress', ''),
                            i.get('PrivateIpAddress', ''),
                            i['State']['Name'],
                            i['Placement']['AvailabilityZone'],
                            i['InstanceType'],
                            ','.join([
                                sg['GroupName'] for sg in i['SecurityGroups']
                            ]),
                            i['KeyName'],
                        ])
            except Exception as e:
                LOG.exception(region, e)

        print(
            tabulate(info,
                     headers=[
                         "Public IP", "Private IP", "State",
                         "Availability Zone", "Type", "Security group", "Key"
                     ]))


if __name__ == "__main__":
    initialize_and_run_commands("AWS utilities", [
        CreateSpotClusterCommand,
        DestroySpotClusterCommand,
        InstallDockerCommand,
        ListInstancesCommand,
    ])