Exemplo n.º 1
0
        public static async Task SaveAndSendBlobTask(string name, Task <Image> task, int Id)
        {
            name = Utility.FormatFileName(Id, name);
            var output = await task;

            if (output == null)
            {
                Log.Warning("Could not create File {0} because Task output was null", name);
                return;
            }
            using (MemoryStream ms = new MemoryStream())
            {
                output.Save(ms, ImageFormat.Png);
                await BlobStorage.UploadBytes(Id, name, ms.ToArray(), "image/png");
            }
            SendSASToICM(name, Id);
            BlobStorageUtility.SaveToFile(name, output, Id);
        }
Exemplo n.º 2
0
 public static void UploadLog(int Id)
 {
     try
     {
         var currentTime = DateTime.UtcNow.ToString("yyMMddTHHmmss", CultureInfo.InvariantCulture);
         var blobName    = String.Format("{0}-{1}_{2}_{3}{4}", Constants.LogFileNamePrefix, Log.UID,
                                         currentTime, Id, Constants.LogFileNameExtension);
         Log.FlushAndClose();
         BlobStorage.UploadStream(Id, blobName, Log.LogStream.BaseStream, "text/plain").GetAwaiter().GetResult();
         var sas = BlobStorage.GetSASToken(Id, blobName);
         Log.SetSAS(sas);
         Log.Information("Log for this automatic run are available here : {0}", sas);
     }
     catch (Exception ex)
     {
         Log.Warning("Failed to upload log for this run");
         Log.Exception(ex);
     }
 }
Exemplo n.º 3
0
 public static string UploadICMRun(int Id, string html)
 {
     try
     {
         var currentTime = DateTime.UtcNow.ToString("yyMMddTHHmmss", CultureInfo.InvariantCulture);
         var blobName    = String.Format("{0}-{1}_{2}_{3}{4}", Constants.LogICMFileNamePrefix, Log.UID,
                                         currentTime, Id, Constants.LogICMExtension);
         BlobStorage.UploadText(Id, blobName, html, "text/html").GetAwaiter().GetResult();
         BlobStorage.UploadText(Id, Constants.LogICMQuick, html, "text/html").GetAwaiter().GetResult();
         var sas = BlobStorage.GetSASToken(Id, blobName);
         Log.Information("ICM log for this run are available here : {0}", sas);
         return(sas);
     }
     catch (Exception ex)
     {
         Log.Warning("Failed to upload ICM log for this run");
         Log.Exception(ex);
         return(null);
     }
 }