Skip to content

getml.data.access

Manages the access to various data sources.

set_s3_access_key_id

set_s3_access_key_id(value: str)

Sets the Access Key ID to S3.

Notes

Note that S3 is not supported on Windows.

In order to retrieve data from S3, you need to set the Access Key ID and the Secret Access Key. You can either set them as environment variables before you start the getML Engine, or you can set them from this module.

PARAMETER DESCRIPTION
value

The value to which you want to set the Access Key ID.

TYPE: str

Source code in getml/data/access.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def set_s3_access_key_id(value: str):
    """Sets the Access Key ID to S3.

    Notes:
        Note that S3 is not supported on Windows.

    In order to retrieve data from S3, you need to set the Access Key ID
    and the Secret Access Key. You can either set them as environment
    variables before you start the getML Engine, or you can set them from
    this module.

    Args:
        value:
            The value to which you want to set the Access Key ID.
    """

    if not isinstance(value, str):
        raise TypeError("'value' must be of type str")

    if not _is_alive():
        raise ConnectionRefusedError(
            """
        Cannot connect to getML Engine.
        Make sure the Engine is running on port '"""
            + str(comm.port)
            + """' and you are logged in.
        See `help(getml.engine)`."""
        )

    cmd: Dict[str, Any] = {}
    cmd["type_"] = "set_s3_access_key_id"
    cmd["name_"] = ""

    with comm.send_and_get_socket(cmd) as sock:
        comm.send_string(sock, value)
        msg = comm.recv_string(sock)
        if msg != "Success!":
            comm.handle_engine_exception(msg)

set_s3_secret_access_key

set_s3_secret_access_key(value: str)

Sets the Secret Access Key to S3.

Notes

Note that S3 is not supported on Windows.

In order to retrieve data from S3, you need to set the Access Key ID and the Secret Access Key. You can either set them as environment variables before you start the getML Engine, or you can set them from this module.

PARAMETER DESCRIPTION
value

The value to which you want to set the Secret Access Key.

TYPE: str

Source code in getml/data/access.py
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
def set_s3_secret_access_key(value: str):
    """Sets the Secret Access Key to S3.

    Notes:
        Note that S3 is not supported on Windows.

    In order to retrieve data from S3, you need to set the Access Key ID
    and the Secret Access Key. You can either set them as environment
    variables before you start the getML Engine, or you can set them from
    this module.

    Args:
        value:
            The value to which you want to set the Secret Access Key.
    """

    if not isinstance(value, str):
        raise TypeError("'value' must be of type str")

    if not _is_alive():
        raise ConnectionRefusedError(
            """
        Cannot connect to getML Engine.
        Make sure the Engine is running on port '"""
            + str(comm.port)
            + """' and you are logged in.
        See `help(getml.engine)`."""
        )

    cmd: Dict[str, Any] = {}
    cmd["type_"] = "set_s3_secret_access_key"
    cmd["name_"] = ""

    with comm.send_and_get_socket(cmd) as sock:
        comm.send_string(sock, value)
        msg = comm.recv_string(sock)
        if msg != "Success!":
            comm.handle_engine_exception(msg)