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

feat: update mlflow graphql #12178

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.linkedin.datahub.graphql.types.common.mappers;

import com.linkedin.datahub.graphql.QueryContext;
import com.linkedin.datahub.graphql.generated.TimeStamp;
import com.linkedin.datahub.graphql.types.mappers.ModelMapper;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class TimeStampMapper implements ModelMapper<com.linkedin.common.TimeStamp, TimeStamp> {

public static final TimeStampMapper INSTANCE = new TimeStampMapper();

public static TimeStamp map(
@Nullable QueryContext context, @Nonnull final com.linkedin.common.TimeStamp timestamp) {
return INSTANCE.apply(context, timestamp);
}

@Override
public TimeStamp apply(
@Nullable QueryContext context, @Nonnull final com.linkedin.common.TimeStamp timestamp) {
final TimeStamp result = new TimeStamp();
result.setTime(timestamp.getTime());
if (timestamp.hasActor()) {
result.setActor(timestamp.getActor().toString());
}
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.linkedin.datahub.graphql.QueryContext;
import com.linkedin.datahub.graphql.generated.DataProcessInstance;
import com.linkedin.datahub.graphql.generated.EntityType;
import com.linkedin.datahub.graphql.types.common.mappers.AuditStampMapper;
import com.linkedin.datahub.graphql.types.common.mappers.TimeStampMapper;
import com.linkedin.datahub.graphql.types.common.mappers.util.MappingHelper;
import com.linkedin.datahub.graphql.types.mappers.ModelMapper;
import com.linkedin.dataprocess.DataProcessInstanceProperties;
Expand Down Expand Up @@ -50,11 +50,13 @@ private void mapDataProcessProperties(
DataProcessInstanceProperties dataProcessInstanceProperties =
new DataProcessInstanceProperties(dataMap);
dpi.setName(dataProcessInstanceProperties.getName());
if (dataProcessInstanceProperties.hasCreated()) {
dpi.setCreated(AuditStampMapper.map(context, dataProcessInstanceProperties.getCreated()));
}

com.linkedin.datahub.graphql.generated.DataProcessInstanceProperties properties =
new com.linkedin.datahub.graphql.generated.DataProcessInstanceProperties();
properties.setCreated(TimeStampMapper.map(context, dataProcessInstanceProperties.getCreated()));
if (dataProcessInstanceProperties.hasExternalUrl()) {
dpi.setExternalUrl(dataProcessInstanceProperties.getExternalUrl().toString());
}
dpi.setProperties(properties);
}
}
112 changes: 107 additions & 5 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Root type used for fetching DataHub Metadata
Coming soon listEntity queries for listing all entities of a given type
"""
type Query {
_empty: String
}


extend type Query {
"""
Fetch a Data Platform by primary key (urn)
"""
Expand Down Expand Up @@ -262,8 +267,16 @@ type Query {
Fetch all Business Attributes
"""
listBusinessAttributes(input: ListBusinessAttributesInput!): ListBusinessAttributesResult

"""
Fetch a Data Process Instance by primary key (urn)
"""
dataProcessInstance(urn: String!): DataProcessInstance


}


"""
An ERModelRelationship is a high-level abstraction that dictates what datasets fields are erModelRelationshiped.
"""
Expand Down Expand Up @@ -6581,12 +6594,12 @@ type DataProcessInstance implements EntityWithRelationships & Entity {
"""
When the run was kicked off
"""
created: AuditStamp
created: AuditStamp!

"""
The name of the data process
"""
name: String
name: String!

"""
Edges extending from this entity.
Expand Down Expand Up @@ -9483,6 +9496,18 @@ type AuditStamp {
actor: String
}

type TimeStamp {
"""
When did the event occur
"""
time: Long!

"""
The actor involved in the event
"""
actor: String
}

"""
Input for creating a new group
"""
Expand Down Expand Up @@ -9829,9 +9854,13 @@ type MLModelGroup implements EntityWithRelationships & Entity & BrowsableEntity

type MLModelGroupProperties {

description: String
description: String

createdAt: Long
createdAt: Long @deprecated(reason: "Use `created` instead")

created: TimeStamp

lastModified: TimeStamp

version: VersionTag
}
Expand Down Expand Up @@ -9994,9 +10023,16 @@ type MLMetric {

type MLModelProperties {

"""
The name of the model used in display
"""
name: String!

description: String

date: Long
date: Long @deprecated(reason: "Use `created` instead")

lastModified: TimeStamp

version: String

Expand All @@ -10008,6 +10044,8 @@ type MLModelProperties {

trainingMetrics: [MLMetric]

trainingJobs: [String!]

mlFeatures: [String!]

tags: [String!]
Expand All @@ -10017,6 +10055,8 @@ type MLModelProperties {
customProperties: [CustomPropertiesEntry!]

externalUrl: String

created: TimeStamp
}

type MLFeatureProperties {
Expand Down Expand Up @@ -12793,3 +12833,65 @@ type CronSchedule {
"""
timezone: String!
}


type DataProcessInstanceProperties {

name: String!

externalUrl: String

created: TimeStamp

customProperties: [CustomPropertiesEntry!]
}


type MLTrainingRunProperties {

id: String

outputUrls: [String]

hyperParams: [MLHyperParam]

trainingMetrics: [MLMetric]
}

extend type DataProcessInstance {

"""
Additional read only properties associated with the Data Job
"""
properties: DataProcessInstanceProperties

"""
Additional properties when subtype is Training Run
"""
mlTrainingRunProperties: MLTrainingRunProperties

"""
The specific instance of the data platform that this entity belongs to
"""
dataPlatformInstance: DataPlatformInstance

"""
Sub Types that this entity implements
"""
subTypes: SubTypes

"""
The parent container in which the entity resides
"""
container: Container

"""
Standardized platform urn where the data process instance is defined
"""
platform: DataPlatform!

"""
Recursively get the lineage of containers for this entity
"""
parentContainers: ParentContainersResult
}
Loading
Loading