Skip to content

Commit

Permalink
Incidental changes for contentPathPattern to contentPathTemplate (#166)
Browse files Browse the repository at this point in the history
Co-authored-by: Aditya Abhishek <adityaa@microsoft.com>
  • Loading branch information
imadityaa and Aditya Abhishek authored Aug 30, 2023
1 parent bb37a4c commit 4be9542
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ public static FileUploadDescriptor CreateDescriptor(FileContext fileContext, IDi
return descriptor;
}

private static string CreateBlobPath(FileContext fileContext, string contentPathPattern, string blobName)
private static string CreateBlobPath(FileContext fileContext, string pathTemplate, string blobName)
{
string blobPath = null;
List<string> pathSegments = new List<string>();

int i = 0;
foreach (string element in contentPathPattern.Split('/'))
foreach (string element in pathTemplate.Split('/'))
{
if (i == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/VirtualClient/VirtualClient.Main/CommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected CommandBase()
/// Parameter defines the content path format/structure using a template to use when uploading content
/// to target storage resources. When not defined the 'Default' structure is used.
/// </summary>
public string ContentPathPattern { get; set; }
public string ContentPathTemplate { get; set; }

/// <summary>s
/// True to have debug/verbose output emitted to standard output on
Expand Down
4 changes: 2 additions & 2 deletions src/VirtualClient/VirtualClient.Main/RunProfileCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public override async Task<int> ExecuteAsync(string[] args, CancellationTokenSou
logger = dependencies.GetService<ILogger>();
packageManager = dependencies.GetService<IPackageManager>();

if (!string.IsNullOrWhiteSpace(this.ContentPathPattern))
if (!string.IsNullOrWhiteSpace(this.ContentPathTemplate))
{
VirtualClientComponent.ContentPathTemplate = this.ContentPathPattern;
VirtualClientComponent.ContentPathTemplate = this.ContentPathTemplate;
}

IEnumerable<string> profileNames = this.GetProfilePaths(dependencies);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ public void VirtualClientDefaultCommandRequiresTheProfileOptionBeSupplied()
[TestCase("--contentstore", "https://anystorageaccount.blob.core.windows.net/;SharedAccessSignature=123")]
[TestCase("--content", "https://anystorageaccount.blob.core.windows.net/;SharedAccessSignature=123")]
[TestCase("--cs", "https://anystorageaccount.blob.core.windows.net/;SharedAccessSignature=123")]
[TestCase("--contentPathPattern", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")]
[TestCase("--contentpathpattern", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")]
[TestCase("--contentPathTemplate", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")]
[TestCase("--contentpathtemplate", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")]
[TestCase("--contentPath", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")]
[TestCase("--cspt", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")]
[TestCase("--contentpath", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")]
[TestCase("--cp", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")]
[TestCase("--debug", null)]
[TestCase("--verbose", null)]
[TestCase("--dependencies", null)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void ContentStoreOptionValidatesTheConnectionTokenProvided()
[TestCase("--contentPath")]
[TestCase("--contentpath")]
[TestCase("--cp")]
public void ContentPathPatternOptionSupportsExpectedAliases(string alias)
public void ContentPathTemplateOptionSupportsExpectedAliases(string alias)
{
Option option = OptionFactory.CreateContentPathTemplateOption();
ParseResult result = option.Parse($"{alias}=\"anyname1/anyname2/{{experimentId}}/{{agentId}}/anyname3/{{toolName}}/{{role}}/{{scenario}}\"");
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guides/0010-command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on the system.
| --a, --agentId, --clientId=\<id\> | No | string/text | An identifier that can be used to uniquely identify the instance of the Virtual Client in telemetry separate from other instances. The default value is the name of the system if this option is not explicitly defined (i.e. the name as defined by the operating system). |
| --port, --api-port=\<port\> | No | integer | The port to use for hosting the Virtual Client REST API service for profiles that allow multi-system, client/server operations (e.g. networking). Additionally, a port may be defined for each role associated with the profile operations using the format {Port}/{Role} with each port/role combination delimited by a comma (e.g. 4501/Client,4502/Server). |
| --cs, --content, --contentStore=\<authtoken\> | No | string/connection string/SAS | A full connection string or SAS URI to an Azure storage account blob store where files/content can be uploaded as part of background monitoring processes. Contact the VC Team to get a SAS URI for your team. See [Azure Storage Account Integration](./0600-integration-blob-storage.md). |
| --cspt, --contentPath, --contentPathPattern=\<folderPattern\> | No | string/text | The content path format/structure to use when uploading content to target storage resources. When not defined the 'Default' structure is used. Default: "{experimentId}/{agentId}/{toolName}/{role}/{scenario}" |
| --cp, --contentPath, --contentPathTemplate=\<folderPattern\> | No | string/text | The content path format/structure to use when uploading content to target storage resources. When not defined the 'Default' structure is used. Default: "{experimentId}/{agentId}/{toolName}/{role}/{scenario}" |
| --eh, --eventHub, --eventHubConnectionString=\<accesspolicy\> | No | string/connection string | A full connection string/access policy for the Azure Event Hub namespace where telemetry should be written. Contact the VC Team to get an access policy for your team. See [Azure Event Hub Integration](./0610-integration-event-hub.md). |
| --e, --experimentId=\<guid\> | No | guid | A unique identifier that defines the ID of the experiment for which the Virtual Client workload is associated. |
| --ff, --fail-fast | No | | Flag indicates that the application should exit immediately on first/any errors regardless of their severity. This applies to 'Actions' in the profile only. 'Dependencies' are ALWAYS implemented to fail fast. 'Monitors' are generally implemented to handle transient issues and to keep running/trying in the background. |
Expand Down
18 changes: 9 additions & 9 deletions website/docs/guides/0600-integration-blob-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,21 @@ are granted to the Virtual Client application for uploading and downloading blob


### Blob Store Folder/File Naming Conventions
In order to ensure that files associated with Virtual Client executors or monitors are easy to find in the blob stores, Virtual Client supports a flexible blob path pattern.
In order to ensure that files associated with Virtual Client executors or monitors are easy to find in the blob stores, Virtual Client supports a flexible blob path template.
At a high level, all files associated with a given experiment are contained together in the blob store.

The virtual path of uploaded logs in blob storage is controlled by a VirtualClient Command Line Option parameter "--contentPathPattern".
The virtual path of uploaded logs in blob storage is controlled by a VirtualClient Command Line Option parameter "--contentPathTemplate".

Example: --contentPathPattern="any-value1/{standardProperty1}any-value2{standardProperty2}/{standardProperty3}/any-value3/{standardProperty4}".
Example: --contentPathTemplate="any-value1/{standardProperty1}any-value2{standardProperty2}/{standardProperty3}/any-value3/{standardProperty4}".

In above example, the virtual blob folder structure will have sub-folders corresponding to each element separated by a '/' in the
ContentPathPattern. The inlined values that are enclosed within brackets "{}", like "standaradProperty1" and "standaradProperty2",
ContentPathTemplate. The inlined values that are enclosed within brackets "{}", like "standaradProperty1" and "standaradProperty2",
needs to be one among the 5 defined standard properties of Virtual Client (ExperimentId, AgentId, ToolName, Role, Scenario).

The first component of ContentPathPattern (any-value1 in above example) will be taken up as the name of Blob storage Container where all files will be uploaded.
The first component of ContentPathTemplate (any-value1 in above example) will be taken up as the name of Blob storage Container where all files will be uploaded.
The next component ({standardProperty1} in above example) will be the root folder within the container and so on for the complete virtual folder structure within the blob storage.

The default value of "ContentPathPattern" is "{experimentId}/{agentId}/{toolName}/{role}/{scenario}". In the default template, each element
The default value of "ContentPathTemplate" is "{experimentId}/{agentId}/{toolName}/{role}/{scenario}". In the default template, each element
is a standard property identified by Virtual Client.

* **Experiment ID**
Expand All @@ -124,7 +124,7 @@ is a standard property identified by Virtual Client.
* **ScenarioName**
It is an indicator of the scenario being tested by the workload. It is defined for each action/monitor in an execution profile.

All files will be uploaded in a virtual folder structure as defined by the ContentPathPattern. For each file uploaded, a timestamp will be
All files will be uploaded in a virtual folder structure as defined by the ContentPathTemplate. For each file uploaded, a timestamp will be
prefixed to it so as to provide unique names.

* **File Name**
Expand All @@ -140,9 +140,9 @@ Given the pieces of information noted above, the format for virtual paths and fi


``` csharp
// ContentPathPattern and Parameters as defined in Virtual Client CommandLine:
// ContentPathTemplate and Parameters as defined in Virtual Client CommandLine:
// -----------------------------------------------
VirtualClient.exe --profile=........ --contentPathPattern="value1/expt_{experimentId}_agent_{agentId}/{toolName}/value-2"
VirtualClient.exe --profile=........ --contentPathTemplate="value1/expt_{experimentId}_agent_{agentId}/{toolName}/value-2"

// Examples:
// -----------------------------------------------
Expand Down

0 comments on commit 4be9542

Please sign in to comment.