Skip to content

Commit

Permalink
fix(RunAsset): include RunInfo in RunAsset to avoid recreating it.
Browse files Browse the repository at this point in the history
  • Loading branch information
MingboPeng committed Mar 8, 2024
1 parent ec3378b commit 9c84fa4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/PollinationSDK/Wrapper/AssetBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ public virtual RunInfo GetRunInfo()
}
else
{
// check cached RunInfo
if (this is RunAssetBase runAsset && runAsset.RunInfo != null)
return runAsset.RunInfo;

// recreate RunInfo
var run = GetRun();
var proj = GetRoject();

Expand Down
2 changes: 1 addition & 1 deletion src/PollinationSDK/Wrapper/RunAssetBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public abstract class RunAssetBase: AssetBase
{

internal RunInfo RunInfo { get; set; }
}


Expand Down
4 changes: 2 additions & 2 deletions src/PollinationSDK/Wrapper/RunInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private static RecipeInterface GetRecipe(string owner, string name, string tag =
public List<RunOutputAsset> GetOutputAssets(string platform)
{
var sourcelink = this.ToString();
var assets = this.GetOutputs().Select(_ => new RunOutputAsset(_, platform, sourcelink)).ToList();
var assets = this.GetOutputs().Select(_ => new RunOutputAsset(_, platform, sourcelink) { RunInfo = this }).ToList();
return assets;
}

Expand All @@ -335,7 +335,7 @@ public List<RunOutputAsset> GetOutputAssets(string platform)
public List<RunInputAsset> GetInputAssets()
{
var sourcelink = this.ToString();
var assets = this.GetInputs().Select(_ => new RunInputAsset(_, sourcelink)).ToList();
var assets = this.GetInputs().Select(_ => new RunInputAsset(_, sourcelink) { RunInfo = this }).ToList();
return assets;

}
Expand Down

0 comments on commit 9c84fa4

Please sign in to comment.