Exemplo n.º 1
0
def large_sensor(_context):
    # create a gRPC response payload larger than the limit (4194304)
    REQUEST_COUNT = 25
    REQUEST_TAG_COUNT = 5000
    REQUEST_CONFIG_COUNT = 100

    for _ in range(REQUEST_COUNT):
        tags_garbage = {
            _random_string(10): _random_string(20)
            for i in range(REQUEST_TAG_COUNT)
        }
        config_garbage = {
            _random_string(10): _random_string(20)
            for i in range(REQUEST_CONFIG_COUNT)
        }
        config = {
            "solids": {
                "config_solid": {
                    "config": {
                        "foo": config_garbage
                    }
                }
            }
        }
        yield RunRequest(run_key=None, run_config=config, tags=tags_garbage)
Exemplo n.º 2
0
 def custom_interval_sensor(_):
     return RunRequest(
         run_key=None,
         run_config={"intermediate_storage": {
             "filesystem": {}
         }},
         tags={"test": "1234"},
     )
Exemplo n.º 3
0
 def once_no_config_sensor(_):
     return RunRequest(
         run_key="once",
         run_config={"intermediate_storage": {
             "filesystem": {}
         }},
         tags={"test": "1234"},
     )
Exemplo n.º 4
0
def run_cursor_sensor(context):
    if not context.cursor:
        cursor = 1
    else:
        cursor = int(context.cursor) + 1

    context.update_cursor(str(cursor))
    return RunRequest(run_key=None, run_config={}, tags={})
Exemplo n.º 5
0
 def toy_file_sensor(_, modified_fileinfo):
     for filename, mtime in modified_fileinfo:
         yield RunRequest(
             run_key="{}:{}".format(filename, str(mtime)),
             run_config={
                 "solids": {
                     "read_file": {
                         "config": {
                             "directory": directory_name,
                             "filename": filename
                         }
                     }
                 }
             },
         )
Exemplo n.º 6
0
def wrong_config_sensor(_context):
    return RunRequest(run_key="bad_config_key",
                      run_config={"bad_key": "bad_val"},
                      tags={})
Exemplo n.º 7
0
def run_key_sensor(_context):
    return RunRequest(run_key="only_once", run_config={}, tags={})
Exemplo n.º 8
0
def always_on_sensor(_context):
    return RunRequest(run_key=None, run_config={}, tags={})
Exemplo n.º 9
0
def simple_sensor(context):
    if not context.last_completion_time or not int(
            context.last_completion_time) % 2:
        return SkipReason()

    return RunRequest(run_key=None, run_config={}, tags={})
Exemplo n.º 10
0
 def foo_sensor(context):
     run_config = {"foo": "FOO"}
     if context.last_completion_time:
         run_config["since"] = context.last_completion_time
     return RunRequest(run_key=None, run_config=run_config)
Exemplo n.º 11
0
 def multi_no_config_sensor(_):
     yield RunRequest(run_key="A")
     yield RunRequest(run_key="B")
Exemplo n.º 12
0
 def always_no_config_sensor(_):
     return RunRequest(run_key=None,
                       run_config={"storage": {
                           "filesystem": {}
                       }},
                       tags={"test": "1234"})
Exemplo n.º 13
0
def sensor_foo(_):
    yield RunRequest(run_key=None, run_config={"foo": "FOO"}, tags={"foo": "foo_tag"})
    yield RunRequest(run_key=None, run_config={"foo": "FOO"})