Skip to content

Commit

Permalink
Merge pull request #145 from IndicoDataSolutions/nate/update_docker
Browse files Browse the repository at this point in the history
update dockerfile
  • Loading branch information
nateshim-indico authored Mar 13, 2024
2 parents 0c58ed2 + 0820ecf commit 79352f1
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 24 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0

WORKDIR indico-client-csharp
COPY . ./
RUN dotnet restore
RUN dotnet build --no-restore -c Release
Expand Down
91 changes: 69 additions & 22 deletions Examples/SubmissionFilterExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,51 +23,80 @@ public static async Task Main()
var workflowIds = new List<int>() { 3106 };

// Example 1
// List all submissions that are complete or failed
var orFilter = new OrFilter
// List all submissions that are COMPLETE and not retrieved
var andFilter = new AndFilter
{
Or = new List<IFilter>
And = new List<IFilter>
{
new SubmissionFilter
{
Status = SubmissionStatus.COMPLETE,
},
new SubmissionFilter
{
Status = SubmissionStatus.FAILED,
Retrieved = false,
}
}
};

var submissions = await submissionClient.ListAsync(submissionIds, workflowIds, orFilter, limit: 10);
submissions = await submissionClient.ListAsync(submissionIds, workflowIds, andFilter, limit: 10);
Console.WriteLine(submissions);

// Example 2
// List all submissions that are COMPLETE and FAILED
var andFilter = new AndFilter
// List all submissions that are complete and not retrieved or failed and not retrieved
var orFilter = new OrFilter
{
And = new List<IFilter>
Or = new List<IFilter>
{
new SubmissionFilter
new AndFilter
{
Status = SubmissionStatus.COMPLETE,
And = new List<IFilter>
{
new SubmissionFilter
{
Status = SubmissionStatus.COMPLETE,
},
new SubmissionFilter
{
Retrieved = false,
}
}
},
new SubmissionFilter
new AndFilter
{
Status = SubmissionStatus.FAILED,
And = new List<IFilter>
{
new SubmissionFilter
{
Status = SubmissionStatus.FAILED,
},
new SubmissionFilter
{
Retrieved = false,
}
}
}
}
};

submissions = await submissionClient.ListAsync(submissionIds, workflowIds, andFilter, limit: 10);
var submissions = await submissionClient.ListAsync(submissionIds, workflowIds, orFilter, limit: 10);
Console.WriteLine(submissions);

// Example 3
// List all submissions that are retrieved and have a filename that contains 'property'
var subFilter = new SubmissionFilter
var subFilter = new AndFilter
{
Retrieved = true,
InputFilename = "property"
And = new List<IFilter>
{
new SubmissionFilter
{
Retrieved = true,
},
new SubmissionFilter
{
InputFilename = "property",
}
}
};

submissions = await submissionClient.ListAsync(submissionIds, workflowIds, subFilter, limit: 10);
Expand All @@ -80,21 +109,39 @@ public static async Task Main()
From = "2022-01-01",
To = DateTime.Now.ToString("yyyy-MM-dd")
};
subFilter = new SubmissionFilter
subFilter = new AndFilter
{
CreatedAt = dateRangeFilter,
UpdatedAt = dateRangeFilter
And = new List<IFilter>
{
new SubmissionFilter
{
CreatedAt = dateRangeFilter,
},
new SubmissionFilter
{
UpdatedAt = dateRangeFilter,
},
}
};

submissions = await submissionClient.ListAsync(submissionIds, workflowIds, subFilter, limit: 10);
Console.WriteLine(submissions);

// Example 5
// List all submissions that are not in progress of being reviewed and are completed
subFilter = new SubmissionFilter
subFilter = new AndFilter
{
Status = SubmissionStatus.COMPLETE,
ReviewInProgress = false
And = new List<IFilter>
{
new SubmissionFilter
{
Status = SubmissionStatus.COMPLETE,
},
new SubmissionFilter
{
ReviewInProgress = false,
}
}
};

submissions = await submissionClient.ListAsync(submissionIds, workflowIds, subFilter, limit: 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static ssSubmissionFilter ConvertToSs(this IFilter filter)
{
ssFilter.Filetype = submissionFilter.FileType.Select(x => (FileType)Enum.Parse(typeof(FileType), x)).ToList();
}
if (string.IsNullOrEmpty(submissionFilter.InputFilename))
if (!string.IsNullOrEmpty(submissionFilter.InputFilename))
{
ssFilter.InputFilename = submissionFilter.InputFilename;
}
Expand Down
56 changes: 56 additions & 0 deletions IndicoV2.IntegrationTests/Submissions/SubmissionClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,62 @@ public async Task ListSubmissions_SubmissionFilterUpdatedAt_ShouldFetchSubmissio
}


[Test]
public async Task ListSubmissions_SubmissionOrAndFilter_ShouldFetchSubmissions()
{
// Arrange
var listData = await _dataHelper.Submissions().ListAnyAsync(_workflowId);

var filters = new OrFilter
{
Or = new List<IFilter>
{
new AndFilter
{
And = new List<IFilter>
{
new SubmissionFilter
{
Status = SubmissionStatus.COMPLETE,
},
new SubmissionFilter
{
Retrieved = false,
}
}
},
new AndFilter
{
And = new List<IFilter>
{
new SubmissionFilter
{
Status = SubmissionStatus.FAILED,
},
new SubmissionFilter
{
Retrieved = false,
}
}
}
}
};
// Act
var submissions = await _submissionsClient.ListAsync(null, new List<int> { listData.workflowId }, filters, 0, 10);

submissions.Should().NotBeNull();
submissions.PageInfo.Should().NotBeNull();
submissions.Data.Should().NotBeNull();
foreach (var submission in submissions.Data)
{
submission.Id.Should().BeGreaterThan(0);
submission.Status.Should().BeOfType<SubmissionStatus>();
submission.Status.Should().Match<SubmissionStatus>(status => status == SubmissionStatus.COMPLETE || status == SubmissionStatus.FAILED);
submission.Retrieved.Should().BeFalse();
}
}



[Test]
public async Task GenerateSubmissionResultAsync_ShouldReturnJob()
Expand Down
2 changes: 1 addition & 1 deletion IndicoV2/IndicoV2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Import Project="../Nuget.props" Condition="'$(BuildType)' == 'V2'" />

<PropertyGroup Condition="'$(BuildType)' == 'V2'">
<AssemblyVersion>2.0.1</AssemblyVersion>
<AssemblyVersion>6.0.0</AssemblyVersion>
<Version Condition="'$(Version)' == ''">$(AssemblyVersion)-preview.$([System.DateTime]::UtcNow.ToString(yyMMddHHmm))</Version>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeP2POutput</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
Expand Down

0 comments on commit 79352f1

Please sign in to comment.