提交 6119d4bb 编写于 作者: B Balaji Soundrarajan

Upload the traces from local machine to the share in \\mlangfs1

上级 69a2ca72
......@@ -23,3 +23,6 @@ string jsonFileName = Path.GetFileName(elapsedTimeViBenchJsonFilePath);
// Move the json file to a file-share
File.Copy(elapsedTimeViBenchJsonFilePath, $@"\\vcbench-srv4\benchview\uploads\vibench\{jsonFileName}");
// Move the traces to mlangfs1 share
UploadTraces(GetCPCDirectoryPath(), @"\\mlangfs1\public\basoundr\PerfTraces");
\ No newline at end of file
......@@ -18,12 +18,3 @@ public void DownloadCPC()
// Copy CPC from the share to cpcDestinationPath
CopyDirectory(cpcSourceBinaryLocation, cpcDestinationPath);
}
\ No newline at end of file
void CopyDirectory(string source, string destination)
{
var result = ShellOutUsingShellExecute("Robocopy", $"/mir {source} {destination}");
if (!result.Succeeded)
{
throw new IOException($"Failed to copy \"{source}\" to \"{destination}\".");
}
}
......@@ -171,3 +171,24 @@ string FirstLine(string input) {
return input.Split(new[] {"\r\n", "\r", "\n"}, System.StringSplitOptions.None)[0];
}
void UploadTraces(string sourceFolderPath, string destinationFolderPath)
{
if (Directory.Exists(sourceFolderPath))
{
// Get the latest written databackup
var directoryToUpload = new DirectoryInfo(sourceFolderPath).GetDirectories("DataBackup*").OrderByDescending(d=>d.LastWriteTimeUtc).FirstOrDefault();
if (directoryToUpload == null)
{
Log($"There are no trace directory starting with DataBackup in {sourceFolderPath}");
return;
}
var destination = Path.Combine(destinationFolderPath, directoryToUpload.Name);
CopyDirectory(directoryToUpload.FullName, destination);
}
else
{
Log($"sourceFolderPath: {sourceFolderPath} does not exist");
}
}
......@@ -251,6 +251,15 @@ ProcessResult ShellOutUsingShellExecute(
};
}
void CopyDirectory(string source, string destination)
{
var result = ShellOutUsingShellExecute("Robocopy", $"/mir {source} {destination}");
if (!result.Succeeded)
{
throw new IOException($"Failed to copy \"{source}\" to \"{destination}\".");
}
}
string StdoutFrom(string program, string args = "") {
var result = ShellOut(program, args);
if (result.Failed) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册