-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: "Source Run" field in Model Version UI page points to wrong run …
…model artifact in Run UI page (#8156) * init Signed-off-by: Weichen Xu <weichen.xu@databricks.com> * format Signed-off-by: Weichen Xu <weichen.xu@databricks.com> * update Signed-off-by: Weichen Xu <weichen.xu@databricks.com> * update test Signed-off-by: Weichen Xu <weichen.xu@databricks.com> * update Signed-off-by: Weichen Xu <weichen.xu@databricks.com> * update Signed-off-by: Weichen Xu <weichen.xu@databricks.com> * update Signed-off-by: Weichen Xu <weichen.xu@databricks.com> * update Signed-off-by: Weichen Xu <weichen.xu@databricks.com> * update Signed-off-by: Weichen Xu <weichen.xu@databricks.com> --------- Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
- Loading branch information
1 parent
928a6ae
commit 4728afe
Showing
4 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
mlflow/server/js/src/model-registry/utils/VersionUtils.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { extractArtifactPathFromModelSource } from './VersionUtils'; | ||
|
||
describe('extractArtifactPathFromModelSource', () => { | ||
it('test extractArtifactPathFromModelSource', () => { | ||
expect( | ||
extractArtifactPathFromModelSource('mlflow-artifacts:/0/01bcd/artifacts/xx/yy', '01bcd'), | ||
).toBe('xx/yy'); | ||
expect( | ||
extractArtifactPathFromModelSource( | ||
'mlflow-artifacts:/0/01bcd/artifacts/artifacts/xx/yy', | ||
'01bcd', | ||
), | ||
).toBe('artifacts/xx/yy'); | ||
expect( | ||
extractArtifactPathFromModelSource('mlflow-artifacts:/0/01bcd/artifacts/xx/yy', '01bce'), | ||
).toBe(undefined); | ||
expect( | ||
extractArtifactPathFromModelSource('file///path/to/mlruns/0/01bcd/artifacts/xx/yy', '01bcd'), | ||
).toBe('xx/yy'); | ||
expect( | ||
extractArtifactPathFromModelSource( | ||
'file///path/to/artifacts/mlruns/0/01bcd/artifacts/xx/yy', | ||
'01bcd', | ||
), | ||
).toBe('xx/yy'); | ||
expect( | ||
extractArtifactPathFromModelSource( | ||
'file///path/to/mlruns/0/01bcd/artifacts/artifacts/xx/yy', | ||
'01bcd', | ||
), | ||
).toBe('artifacts/xx/yy'); | ||
expect( | ||
extractArtifactPathFromModelSource('file///path/to/mlruns/0/01bcd/artifacts/xx/yy', '01bce'), | ||
).toBe(undefined); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Extract artifact path from provided `modelSource` string | ||
*/ | ||
export function extractArtifactPathFromModelSource(modelSource: string, runId: string) { | ||
return modelSource.match(new RegExp(`/${runId}/artifacts/(.+)`))?.[1]; | ||
} |