How to use the @pulumi/cloud.Task function in @pulumi/cloud

To help you get started, we’ve selected a few @pulumi/cloud examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulumi / examples / cloud-ts-thumbnailer / index.ts View on Github external
// Copyright 2016-2018, Pulumi Corporation.  All rights reserved.

import * as cloud from "@pulumi/cloud";

// A bucket to store videos and thumbnails.
const bucket = new cloud.Bucket("bucket");

// A task which runs a containerized FFMPEG job to extract a thumbnail image.
const ffmpegThumbnailTask = new cloud.Task("ffmpegThumbTask", {
    build: "./docker-ffmpeg-thumb",
    memoryReservation: 512,
});

// When a new video is uploaded, run the FFMPEG task on the video file.
// Use the time index specified in the filename (e.g. cat_00-01.mp4 uses timestamp 00:01)
bucket.onPut("onNewVideo", async (bucketArgs) => {
    console.log(`*** New video: file ${bucketArgs.key} was uploaded at ${bucketArgs.eventTime}.`);
    const file = bucketArgs.key;

    const thumbnailFile = file.substring(0, file.indexOf('_')) + '.jpg';
    const framePos = file.substring(file.indexOf('_')+1, file.indexOf('.')).replace('-',':');

    ffmpegThumbnailTask.run({
        environment: {
            "BUCKET":      bucketArgs.id,
github pulumi / pulumi-cloud / examples / containers / index.ts View on Github external
client.set(key, value, (err: any, v: any) => {
                        if (err) {
                            reject(err);
                        } else {
                            resolve();
                        }
                    });
                });
            });
        };
    }
}

let cache = new Cache("examples-mycache");

let helloTask = new cloud.Task("examples-hello-world", {
    image: "hello-world",
    memory: 20,
});

// build an anonymous image:
let builtService = new cloud.Service("examples-nginx2", {
    containers: {
        nginx: {
            build: "./app",
            memory: 128,
            ports: [{ port: 80 }],
        },
    },
    replicas: 2,
    waitForSteadyState: false,
});

@pulumi/cloud

A highly productive, cloud neutral programming model.

Apache-2.0
Latest version published 10 months ago

Package Health Score

72 / 100
Full package analysis