Skip to content
Closed
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0eeb752
Add counter, refactor PullRequest object for beter names
par456 Jul 17, 2025
abdfc98
Continuing to fix names
par456 Jul 17, 2025
8c9882b
Counter responding to github
par456 Jul 18, 2025
6e5d902
Working Counter
par456 Jul 18, 2025
7d1b324
Logs appearing on page
par456 Jul 18, 2025
7808e0c
Updates to chart page
par456 Aug 4, 2025
b74fd1a
attempt to work aorund transient errors
ric394 Aug 7, 2025
2562e27
Refactor to recursive function
par456 Aug 7, 2025
b9787a6
Remove github status updates for each adddata call
par456 Aug 7, 2025
13de03e
changes to handle write retries
ric394 Aug 15, 2025
b8257f1
Making timer work better
par456 Aug 21, 2025
7ef83d3
Lock checks
par456 Aug 26, 2025
b43f873
Single timer
par456 Sep 3, 2025
560434a
Add NodeStatuses list to track how many nodes have finished successfully
ric394 Sep 4, 2025
add1e02
Lots of changes in an attempt to track job finishes
par456 Sep 10, 2025
b38b196
add pool member to PullRequestDetails
ric394 Sep 10, 2025
9641eda
Add Azure batch package to allow batch resource handling
ric394 Sep 10, 2025
aa4575d
Create AzureBatchManager class for handling batch related functions
ric394 Sep 10, 2025
97919ba
When closing a PR make it also close the PR's Azure Batch pool
ric394 Sep 10, 2025
e9cdb75
Change Collector to accept a pool value used with github workflow for…
ric394 Sep 10, 2025
2670ccf
Fix Collector tests where RetrieveData method was missing an argument
ric394 Sep 10, 2025
60a4e77
fix unit tests
ric394 Sep 10, 2025
4879520
Add a script that builds and pushes postats2 images
ric394 Sep 11, 2025
1136d10
Change timeout and ensure azure batch manager can close a pool
ric394 Sep 12, 2025
013411c
Improve error messages regarding Azure batch pool value
ric394 Sep 15, 2025
c758520
Fix Open PR endpoint and related methods to include pool property
ric394 Sep 15, 2025
48730be
Merging wheat back together
par456 Sep 16, 2025
63a89ad
Initialise Tables
par456 Sep 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/push-to-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
id: metadata-portal
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: apsiminitiative/postats-portal2
images: apsiminitiative/postats2-portal
flavor: latest=true
tags: |
type=ref,event=branch
Expand All @@ -38,15 +38,15 @@ jobs:
context: .
file: ./dockerfile
push: true
target: postats-portal2
target: postats2-portal
tags: ${{ steps.metadata-portal.outputs.tags }}
labels: ${{ steps.metadata-portal.outputs.labels }}

- name: Extract metadata (tags, labels) for Docker
id: metadata-collector
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: apsiminitiative/postats-collector2
images: apsiminitiative/postats2-collector
flavor: latest=true
tags: |
type=ref,event=branch
Expand All @@ -58,6 +58,6 @@ jobs:
context: .
file: ./dockerfile
push: true
target: postats-collector2
target: postats2-collector
tags: ${{ steps.metadata-collector.outputs.tags }}
labels: ${{ steps.metadata-collector.outputs.labels }}
4 changes: 2 additions & 2 deletions APSIM.POStats.Collector/APSIM.POStats.Collector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.9" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
55 changes: 32 additions & 23 deletions APSIM.POStats.Collector/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ static int Main(string[] args)
Console.WriteLine(" 3. (int) Commit Id");
Console.WriteLine(" 4. (string) UserID");
Console.WriteLine(" 5. (datetime) Date");
Console.WriteLine(" 6. (string) Directories (space separated)");
Console.WriteLine(" 6. (string) Azure pool");
Console.WriteLine(" 7. (string) Directories (space separated)");
Console.WriteLine(@" Example: APSIM.POStats.Collector Upload 1111 abcdef12345 2016.12.01-06:33 hol353 c:\Apsimx\Tests c:\Apsimx\UnderReview");
return 1;
}
Expand All @@ -52,18 +53,24 @@ static int Main(string[] args)
//get the run date
DateTime runDate = DateTime.ParseExact(args[4], "yyyy.M.d-HH:mm", CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal);

//get the directories
List<string> searchDirectories = new List<string>();
for (int i = 5; i < args.Length; i++)
//get the pool name
string pool = args[5];

//get the file paths
List<string> filePaths = new List<string>();
for (int i = 6; i < args.Length; i++)
{
if (Directory.Exists(args[i]))
searchDirectories.Add(args[i]);
if (File.Exists(args[i]))
{
filePaths.Add(args[i]);
}
else
throw new Exception($"Directory \"{args[i]}\" does not exist.");
throw new Exception($"File \"{args[i]}\" does not exist.");
}


//get the Pull Request details
PullRequest pullRequest = Shared.Collector.RetrieveData(pullId, commitId, author, runDate, searchDirectories);
PullRequestDetails pullRequest = Shared.Collector.RetrieveData(pullId, commitId, author, runDate, pool, filePaths);

string url = Environment.GetEnvironmentVariable("POSTATS_UPLOAD_URL");
Console.WriteLine($"{url}");
Expand All @@ -75,7 +82,7 @@ static int Main(string[] args)
if (command == "open")
{
// Tell endpoint we're about to upload data.
Task<string> response = WebUtilities.GetAsync($"{url}/open?pullrequestnumber={pullRequest.Number}&commitnumber={pullRequest.LastCommit}&author={pullRequest.Author}");
Task<string> response = WebUtilities.GetAsync($"{url}/open?pullrequestnumber={pullRequest.PullRequest}&commitnumber={pullRequest.Commit}&author={pullRequest.Author}");
response.Wait();
}
else if (command == "upload")
Expand All @@ -87,7 +94,7 @@ static int Main(string[] args)
}
else if (command == "close")
{
Task<string> response = WebUtilities.GetAsync($"{url}/close?pullrequestnumber={pullRequest.Number}&commitid={pullRequest.LastCommit}");
Task<string> response = WebUtilities.GetAsync($"{url}/close?pullrequestnumber={pullRequest.PullRequest}&commitid={pullRequest.Commit}");
response.Wait();
}
//this is provided for Jenkins so it can continue to run with the original uploading code
Expand All @@ -96,7 +103,7 @@ static int Main(string[] args)
//get the Pull Request details
PullRequestJenkins pullRequestJenkins = new PullRequestJenkins();
pullRequestJenkins.Id = pullRequest.Id;
pullRequestJenkins.Number = pullRequest.Number;
pullRequestJenkins.Number = pullRequest.PullRequest;
pullRequestJenkins.Author = pullRequest.Author;
pullRequestJenkins.DateRun = pullRequest.DateRun;
pullRequestJenkins.DateStatsAccepted = pullRequest.DateStatsAccepted;
Expand Down Expand Up @@ -125,26 +132,28 @@ static int Main(string[] args)
/// <param name="urlEnvironmentVariable"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
private static void UploadStats(PullRequest pullRequest, string url)
private static void UploadStats(PullRequestDetails pullRequest, string url)
{
List<ApsimFile> files = new();
files.AddRange(pullRequest.Files);
foreach (var file in files)
{
// Upload data for one file only.
pullRequest.Files.Clear();
pullRequest.Files.Add(file);

try
//In the case we have no files produced, just send it back empty.
if (files.Count == 0)
{
Task<string> response = WebUtilities.PostAsync($"{url}/adddata", pullRequest, null);
response.Wait();
}
else
{
foreach (var file in files)
{
// Upload data for one file only.
pullRequest.Files = new List<ApsimFile>();
pullRequest.Files.Add(file);

Task<string> response = WebUtilities.PostAsync($"{url}/adddata", pullRequest, null);
response.Wait();
}
catch (Exception exception)
{
Console.WriteLine($"Error when collecting file {file.Name}");
Console.WriteLine(exception.Message);
}
}
}

Expand Down
17 changes: 9 additions & 8 deletions APSIM.POStats.Portal/APSIM.POStats.Portal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Google.DataTable.Net.Wrapper" Version="4.0.0" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="6.0.33" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.33" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.33" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.33" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.33">
<PackageReference Include="Google.DataTable.Net.Wrapper" Version="4.1.0" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.18" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.18" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.18" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.18" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.18">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.9" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.3" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
<PackageReference Include="Microsoft.Azure.Batch" Version="16.3.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading
Loading