Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CAT-323] deprecreate loadModel #120

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Indico.Tests/Mutation/ModelGroupLoadTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Indico.Tests.Mutation
{
[TestClass]
[Ignore]
public class ModelGroupQueryTest
{
private GraphQLHttpClient _client;
Expand Down
35 changes: 1 addition & 34 deletions Indico/Mutation/ModelGroupLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,39 +57,6 @@ public ModelGroupLoad ModelGroup(ModelGroup modelGroup)
/// Executes request and returns load status.
/// </summary>
/// <returns>Load status.</returns>
public async Task<string> Exec(CancellationToken cancellationToken = default)
{
var query = @"
mutation LoadModel($model_id: Int!) {
modelLoad(modelId: $model_id) {
status
}
}
";

var request = new GraphQLRequest()
{
Query = query,
OperationName = "LoadModel",
Variables = new
{
model_id = ModelId
}
};

var response = await _graphQLHttpClient.SendMutationAsync<dynamic>(request, cancellationToken);
if (response.Errors != null)
{
throw new GraphQLException(response.Errors);
}

var modelLoad = response.Data.modelLoad;
if (modelLoad == null)
{
throw new RuntimeException($"Cannot Load Model id : {ModelId}");
}

return (string)modelLoad.status;
}
public async Task<string> Exec(CancellationToken cancellationToken = default) => "Success";
}
}
4 changes: 3 additions & 1 deletion IndicoV2.Abstractions/Models/IModelClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using IndicoV2.Models.Models;
Expand All @@ -21,6 +22,7 @@ public interface IModelClient
/// <param name="modelId"><seealso cref="IModel"/>'s Id</param>
/// <param name="cancellationToken"><c><see cref="CancellationToken"/></c> for handling cancellation of asynchronous operations.</param>
/// <returns>Status</returns>
[Obsolete("Models are now automatically loaded by IPA")]
Task<string> LoadModel(int modelId, CancellationToken cancellationToken);

/// <summary>
Expand Down
6 changes: 4 additions & 2 deletions IndicoV2.V1Adapters/Models/V1ModelClientAdapter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Indico.Mutation;
Expand All @@ -21,7 +22,8 @@ public async Task<IModelGroup> GetGroup(int modelGroupId, CancellationToken canc
{
MgId = modelGroupId
}.Exec(cancellationToken));


[Obsolete("Models are now automatically loaded by IPA")]
public Task<string> LoadModel(int modelId, CancellationToken cancellationToken) =>
new ModelGroupLoad(_clientLegacy.GraphQLHttpClient) {ModelId = modelId}.Exec(cancellationToken);

Expand Down
Loading