# coding: utf8

import os
import datetime
import taskcluster

task_id = taskcluster.slugId()
payload = {
    "taskGroupId": os.environ["DECISION_TASK_ID"],
    "dependencies": [os.environ["DECISION_TASK_ID"]],
    "schedulerId": "taskcluster-github",  # FIXME: can we avoid hard-coding this?
    "provisionerId": "aws-provisioner-v1",
    "workerType": "github-worker",
    "created": taskcluster.fromNowJSON(""),
    "deadline": taskcluster.fromNowJSON("1 hour"),
    "metadata": {
        "name": "Taskcluster experiments for Servo: Child task",
        "description": "",
        "owner": os.environ["DECISION_TASK_OWNER"],
        "source": os.environ["DECISION_TASK_SOURCE"],
    },
    "payload": {
        "maxRunTime": 600,
        "image": "buildpack-deps:bionic-scm",
        "command": [
            "/bin/bash",
            "--login",
            "-c",
            """
                git clone %(DECISION_TASK_CLONE_URL)s repo &&
                cd repo &&
                git checkout %(DECISION_TASK_COMMIT_SHA)s &&
                ./child-task.sh
            """ % os.environ,
        ],
    },
}
# https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/features#feature-taskclusterproxy
queue = taskcluster.Queue(options={"baseUrl": "http://taskcluster/queue/v1/"})
result = queue.createTask(task_id, payload)
print("task %s created…? %r" % (task_id, result))

# coding: utf8

import os
import datetime
import taskcluster

task_id = taskcluster.slugId()
payload = {
    "taskGroupId": os.environ["DECISION_TASK_ID"],
    "dependencies": [os.environ["DECISION_TASK_ID"]],
    "schedulerId": "taskcluster-github",  # FIXME: can we avoid hard-coding this?
    "provisionerId": "aws-provisioner-v1",
    "workerType": "github-worker",
    "created": taskcluster.fromNowJSON(""),
    "deadline": taskcluster.fromNowJSON("1 hour"),
    "metadata": {
        "name": "Taskcluster experiments for Servo: Child task",
        "description": "",
        "owner": os.environ["DECISION_TASK_OWNER"],
        "source": os.environ["DECISION_TASK_SOURCE"],
    },
    "payload": {
        "maxRunTime": 600,
        "image": "buildpack-deps:bionic",
        "command": [
            "/bin/bash",
            "--login",
            "-c",
            """
                git clone %(DECISION_TASK_CLONE_URL)s repo &&
                cd repo &&
                git checkout %(DECISION_TASK_COMMIT_SHA)s &&
                ./child-task.sh
            """ % os.environ,
        ],
    },
}
# https://docs.taskcluster.net/docs/reference/workers/docker-worker/docs/features#feature-taskclusterproxy
queue = taskcluster.Queue(options={"baseUrl": "http://taskcluster/queue/v1/"})
result = queue.createTask(task_id, payload)
print("task %s created…? %r" % (task_id, result))

Use a Docker image with gcc, in order to link Rust code