Skip to content

[ML-19342] Fix cross-workspace job source link on databricks#5174

Merged
liangz1 merged 5 commits into
mlflow:masterfrom
liangz1:ML-19342
Dec 24, 2021
Merged

[ML-19342] Fix cross-workspace job source link on databricks#5174
liangz1 merged 5 commits into
mlflow:masterfrom
liangz1:ML-19342

Conversation

@liangz1

@liangz1 liangz1 commented Dec 16, 2021

Copy link
Copy Markdown

Signed-off-by: Liang Zhang liang.zhang@databricks.com

What changes are proposed in this pull request?

Cross-workspace job source link and notebook source link are incorrect because it does not use the workspace URL and workspace ID that the job/notebook is executed on, but uses it's own workspace URL and workspace ID. This PR fixes them by using the logged correct workspace URL and workspace ID.

How is this patch tested?

Unit test: existing test fixed.

Does this PR change the documentation?

  • No. You can skip the rest of this section.
  • Yes. Make sure the changed pages / sections render correctly by following the steps below.
  1. Check the status of the ci/circleci: build_doc check. If it's successful, proceed to the
    next step, otherwise fix it.
  2. Click Details on the right to open the job page of CircleCI.
  3. Click the Artifacts tab.
  4. Click docs/build/html/index.html.
  5. Find the changed pages / sections and make sure they render correctly.

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

(Details in 1-2 sentences. You can just refer to another PR with a description if this PR is part of a larger change.)

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/artifacts: Artifact stores and artifact logging
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages
  • area/examples: Example code
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/projects: MLproject format, project running backends
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/server-infra: MLflow Tracking server backend
  • area/tracking: Tracking Service, tracking client APIs, autologging

Interface

  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/docker: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
  • area/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registry
  • area/windows: Windows support

Language

  • language/r: R APIs and clients
  • language/java: Java APIs and clients
  • language/new: Proposals for new client languages

Integrations

  • integrations/azure: Azure and Azure ML integrations
  • integrations/sagemaker: SageMaker integrations
  • integrations/databricks: Databricks integrations

How should the PR be classified in the release notes? Choose one:

  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Signed-off-by: Liang Zhang <liang.zhang@databricks.com>
@github-actions github-actions Bot added area/tracking Tracking service, tracking client APIs, autologging integrations/databricks Databricks integrations rn/none List under Small Changes in Changelogs. labels Dec 16, 2021
@liangz1 liangz1 changed the title [ML-19342] Fix cross-workspace job source link on databricks [ML-19342][WIP] Fix cross-workspace job source link on databricks Dec 16, 2021
@liangz1 liangz1 requested a review from dbczumar December 16, 2021 00:48

@dbczumar dbczumar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! @liangz1 Can we update this test case

def test_databricks_job_run_context_tags():
patch_job_id = mock.patch("mlflow.utils.databricks_utils.get_job_id")
patch_job_run_id = mock.patch("mlflow.utils.databricks_utils.get_job_run_id")
patch_job_type = mock.patch("mlflow.utils.databricks_utils.get_job_type")
patch_webapp_url = mock.patch("mlflow.utils.databricks_utils.get_webapp_url")
with multi_context(patch_job_id, patch_job_run_id, patch_job_type, patch_webapp_url) as (
job_id_mock,
job_run_id_mock,
job_type_mock,
webapp_url_mock,
):
assert DatabricksJobRunContext().tags() == {
MLFLOW_SOURCE_NAME: "jobs/{job_id}/run/{job_run_id}".format(
job_id=job_id_mock.return_value, job_run_id=job_run_id_mock.return_value
),
MLFLOW_SOURCE_TYPE: SourceType.to_string(SourceType.JOB),
MLFLOW_DATABRICKS_JOB_ID: job_id_mock.return_value,
MLFLOW_DATABRICKS_JOB_RUN_ID: job_run_id_mock.return_value,
MLFLOW_DATABRICKS_JOB_TYPE: job_type_mock.return_value,
MLFLOW_DATABRICKS_WEBAPP_URL: webapp_url_mock.return_value,
}
to ensure that CI passes before merging?

Signed-off-by: Liang Zhang <liang.zhang@databricks.com>
@liangz1 liangz1 changed the title [ML-19342][WIP] Fix cross-workspace job source link on databricks [ML-19342] Fix cross-workspace job source link on databricks Dec 22, 2021
Liang Zhang added 2 commits December 22, 2021 15:42
Signed-off-by: Liang Zhang <liang.zhang@databricks.com>
Signed-off-by: Liang Zhang <liang.zhang@databricks.com>
Comment on lines +42 to +44
if workspace_url is not None:
tags[MLFLOW_DATABRICKS_WORKSPACE_URL] = workspace_url
tags[MLFLOW_DATABRICKS_WORKSPACE_ID] = workspace_id

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: What if workspace_url is None but workspace_id is not None, and vice versa?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it makes sense to not assume that they are dependent on each other.

@dbczumar dbczumar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Liang Zhang <liang.zhang@databricks.com>
@liangz1 liangz1 merged commit cf6ad38 into mlflow:master Dec 24, 2021
@liangz1 liangz1 deleted the ML-19342 branch December 24, 2021 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tracking Tracking service, tracking client APIs, autologging integrations/databricks Databricks integrations rn/none List under Small Changes in Changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants