Example #1
0
        public static void RecordTime(IBinder binder, TextWriter logger)
        {
            var start = $"{DateTime.UtcNow:yyyyMMdd-HHmmss}";

            var blobAttribute = new BlobAttribute($"output/{start}");
            var blob = binder.Bind<CloudBlockBlob>(blobAttribute);

            blob.UploadText(start);
            logger.WriteLine(start);

            //RecordTimeAndSleep(start, blob, logger);
            RecordTimes(start, blob, logger);
        }
        /// <summary>
        /// Waits for message from the queue and creates shuffles
        /// </summary>
        /// <param name="shufflerequest">The message received from queue</param>
        public static void CreateShuffle(
            [QueueTrigger("shufflerequests")] ShuffleRequestMessage shufflerequest,
            IBinder binder)
        {
            string shuffleId = shufflerequest.ShuffleId;

            ImageProcessingJobs processor = new ImageProcessingJobs();
            string shuffle = processor.CreateShuffle(shuffleId);

            BlobAttribute attribute = new BlobAttribute("shuffle" + shuffleId + @"/shuffle.jpg", FileAccess.Write);
            Stream shuffleBlob = binder.Bind<Stream>(attribute);

            using (Stream localShuffle = File.OpenRead(shuffle))
            {
                localShuffle.CopyTo(shuffleBlob);
            }
        }