diff --git a/.gitignore b/.gitignore index 0512afa3fa75c..3874ff015aa6a 100644 --- a/.gitignore +++ b/.gitignore @@ -115,6 +115,3 @@ a.md # Ignore a gunicorn config file gunicorn.conf.py - -# GraphQL generated schema -mlflow/server/graphql/do_not_modify_autogenerated_schema.gql diff --git a/dev/proto_to_graphql/autogeneration_utils.py b/dev/proto_to_graphql/autogeneration_utils.py index 22563b198f97b..0aa7b4f2340f5 100644 --- a/dev/proto_to_graphql/autogeneration_utils.py +++ b/dev/proto_to_graphql/autogeneration_utils.py @@ -15,9 +15,7 @@ def get_git_root(): SCHEMA_EXTENSION_MODULE = "mlflow.server.graphql.graphql_schema_extensions" SCHEMA_EXTENSION = get_git_root() + "mlflow/server/graphql/graphql_schema_extensions.py" AUTOGENERATED_SCHEMA = get_git_root() + "mlflow/server/graphql/autogenerated_graphql_schema.py" -AUTOGENERATED_SDL_SCHEMA = ( - get_git_root() + "mlflow/server/graphql/do_not_modify_autogenerated_schema.gql" -) +AUTOGENERATED_SDL_SCHEMA = get_git_root() + "mlflow/server/js/src/graphql/autogenerated_schema.gql" DUMMY_FIELD = ( "dummy = graphene.Boolean(description=" "'Dummy field required because GraphQL does not support empty types.')" diff --git a/mlflow/server/js/.prettierignore b/mlflow/server/js/.prettierignore index a2b975a00d691..d81f30eac2d7c 100644 --- a/mlflow/server/js/.prettierignore +++ b/mlflow/server/js/.prettierignore @@ -16,4 +16,5 @@ __generated__ *.md *.css -*.html \ No newline at end of file +*.html +*.gql diff --git a/mlflow/server/js/src/graphql/autogenerated_schema.gql b/mlflow/server/js/src/graphql/autogenerated_schema.gql new file mode 100644 index 0000000000000..727d9548dcc8c --- /dev/null +++ b/mlflow/server/js/src/graphql/autogenerated_schema.gql @@ -0,0 +1,179 @@ +# GENERATED FILE. PLEASE DON'T MODIFY. +# Run python3 ./dev/proto_to_graphql/code_generator.py to regenerate. + +type Query { + mlflowGetExperiment(input: MlflowGetExperimentInput): MlflowGetExperimentResponse + mlflowGetRun(input: MlflowGetRunInput): MlflowGetRunResponse + mlflowSearchModelVersions(input: MlflowSearchModelVersionsInput): MlflowSearchModelVersionsResponse + + """Simple echoing field""" + test(inputString: String): Test +} + +type MlflowGetExperimentResponse { + experiment: MlflowExperiment +} + +type MlflowExperiment { + experimentId: String + name: String + artifactLocation: String + lifecycleStage: String + lastUpdateTime: LongString + creationTime: LongString + tags: [MlflowExperimentTag!] +} + +""" +LongString Scalar type to prevent truncation to max integer in JavaScript. +""" +scalar LongString + +type MlflowExperimentTag { + key: String + value: String +} + +input MlflowGetExperimentInput { + experimentId: String +} + +type MlflowGetRunResponse { + run: MlflowRunExtension +} + +type MlflowRunExtension { + info: MlflowRunInfo + data: MlflowRunData + inputs: MlflowRunInputs + experiment: MlflowExperiment + modelVersions: [MlflowModelVersion!] +} + +type MlflowRunInfo { + runId: String + runUuid: String + runName: String + experimentId: String + userId: String + status: MlflowRunStatus + startTime: LongString + endTime: LongString + artifactUri: String + lifecycleStage: String +} + +enum MlflowRunStatus { + RUNNING + SCHEDULED + FINISHED + FAILED + KILLED +} + +type MlflowRunData { + metrics: [MlflowMetric!] + params: [MlflowParam!] + tags: [MlflowRunTag!] +} + +type MlflowMetric { + key: String + value: Float + timestamp: LongString + step: LongString +} + +type MlflowParam { + key: String + value: String +} + +type MlflowRunTag { + key: String + value: String +} + +type MlflowRunInputs { + datasetInputs: [MlflowDatasetInput!] +} + +type MlflowDatasetInput { + tags: [MlflowInputTag!] + dataset: MlflowDataset +} + +type MlflowInputTag { + key: String + value: String +} + +type MlflowDataset { + name: String + digest: String + sourceType: String + source: String + schema: String + profile: String +} + +type MlflowModelVersion { + name: String + version: String + creationTimestamp: LongString + lastUpdatedTimestamp: LongString + userId: String + currentStage: String + description: String + source: String + runId: String + status: MlflowModelVersionStatus + statusMessage: String + tags: [MlflowModelVersionTag!] + runLink: String + aliases: [String] +} + +enum MlflowModelVersionStatus { + PENDING_REGISTRATION + FAILED_REGISTRATION + READY +} + +type MlflowModelVersionTag { + key: String + value: String +} + +input MlflowGetRunInput { + runId: String + runUuid: String +} + +type MlflowSearchModelVersionsResponse { + modelVersions: [MlflowModelVersion!] + nextPageToken: String +} + +input MlflowSearchModelVersionsInput { + filter: String + maxResults: LongString + orderBy: [String] + pageToken: String +} + +type Test { + """Echoes the input string""" + output: String +} + +type Mutation { + """Simple echoing field""" + testMutation(inputString: String): TestMutation +} + +type TestMutation { + """Echoes the input string""" + output: String +} + diff --git a/mlflow/server/js/src/graphql/graphql-codegen.ts b/mlflow/server/js/src/graphql/graphql-codegen.ts index 41049c9b8b193..724dbbe1fc845 100644 --- a/mlflow/server/js/src/graphql/graphql-codegen.ts +++ b/mlflow/server/js/src/graphql/graphql-codegen.ts @@ -1,7 +1,7 @@ import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { - schema: [`../graphql/do_not_modify_autogenerated_schema.gql`], + schema: [`./src/graphql/autogenerated_schema.gql`], documents: ['src/**/!(*.test).js*', 'src/**/!(*.test).ts*'], config: { avoidOptionals: {