def worker_spec(domain, master_ip, port, image, model, instances, registry, tag, env, cpu, mem):
    env['MASTER_ADDR'] = "tcp://%s:%d" % (master_ip, port)
    env['RECORDINGS_SAVER_ADDR'] = "tcp://%s:%d" % (master_ip, port + 5)
    env['MODEL'] = model

    return {
        "id": "worker" + model,
        "container": {
            "type": "DOCKER",
            "docker": {
                "image": "%s/%s:%s" % (registry, image, tag),
                "network": "BRIDGE",
                "portMappings": [
                    {"containerPort": 5678, "hostPort": 0}
                ]
            }
        },
        "instances": instances,
        "cpus": cpu,
        "mem": mem,
        "env": env,
        "dependencies": [
            "/%s/master" % domain,
            "/%s/recordings" % domain
        ]
    }
dataset/ETHPy150Open UFAL-DSG/cloud-asr/deployment/run_on_mesos.py/worker_spec/original