示例#1
0
        public static async Task SaveAndSendBlobTask(string name, Task <Stream> 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;
            }
            await BlobStorage.UploadStream(Id, name, output);

            SendSASToICM(name, Id);
            Utility.SaveToFile(name, output, Id);
        }
示例#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);
     }
 }