Esempio n. 1
0
def _get_metadata_from_from_aws(please_stop):
    with suppress_exception:
        from pyLibrary import aws

        ec2 = aws.get_instance_metadata()
        if ec2:
            machine_metadata.aws_instance_type = ec2.instance_type
            machine_metadata.name = ec2.instance_id
Esempio n. 2
0
def _get_metadata_from_from_aws(please_stop):
    with suppress_exception:
        from pyLibrary import aws

        ec2 = aws.get_instance_metadata()
        if ec2:
            machine_metadata.aws_instance_type = ec2.instance_type
            machine_metadata.name = ec2.instance_id
Esempio n. 3
0
        "file": (f[0] if f[0] != "~" else "").replace("\\", "/"),
        "line": f[1],
        "method": f[2].lstrip("<").rstrip(">")
    }
        for f, d, in acc.stats.iteritems()
    ]
    stats_file = File(profile_settings.filename, suffix=convert.datetime2string(datetime.now(), "_%Y%m%d_%H%M%S"))
    stats_file.write(convert.list2tab(stats))


# GET THE MACHINE METADATA
ec2 = Null
try:
    from pyLibrary import aws

    ec2 = aws.get_instance_metadata()
except Exception:
    pass

machine_metadata = wrap({
    "python": platform.python_implementation(),
    "os": (platform.system() + platform.release()).strip(),
    "instance_type": ec2.instance_type,
    "name": coalesce(ec2.instance_id, platform.node())
})


if not Log.main_log:
    Log.main_log = Log_usingStream(sys.stdout)

Esempio n. 4
0
        "self_time_per_call": d[2] / d[1],
        "total_time_per_call": d[3] / d[1],
        "file": (f[0] if f[0] != "~" else "").replace("\\", "/"),
        "line": f[1],
        "method": f[2].lstrip("<").rstrip(">")
    } for f, d, in acc.stats.iteritems()]
    stats_file = File(profile_settings.filename,
                      suffix=convert.datetime2string(datetime.now(),
                                                     "_%Y%m%d_%H%M%S"))
    stats_file.write(convert.list2tab(stats))


# GET THE MACHINE METADATA
ec2 = Null
try:
    from pyLibrary import aws

    ec2 = aws.get_instance_metadata()
except Exception:
    pass

machine_metadata = wrap({
    "python": platform.python_implementation(),
    "os": (platform.system() + platform.release()).strip(),
    "instance_type": ec2.instance_type,
    "name": coalesce(ec2.instance_id, platform.node())
})

if not Log.main_log:
    Log.main_log = Log_usingStream(sys.stdout)