Skip to content

Introduces support to launch MLflow Projects on YARN.#40

Open
vguerra wants to merge 27 commits into
criteo-masterfrom
yarn-backend
Open

Introduces support to launch MLflow Projects on YARN.#40
vguerra wants to merge 27 commits into
criteo-masterfrom
yarn-backend

Conversation

@vguerra

@vguerra vguerra commented Nov 15, 2019

Copy link
Copy Markdown

What changes are proposed in this pull request?

(Please fill in changes proposed in this fix)

How is this patch tested?

(Details)

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) does this PR affect?

  • UI
  • CLI
  • API
  • REST-API
  • Examples
  • Docs
  • Tracking
  • Projects
  • Artifacts
  • Models
  • Scoring
  • Serving
  • R
  • Java
  • Python

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

@codecov-io

codecov-io commented Nov 15, 2019

Copy link
Copy Markdown

Codecov Report

Merging #40 into criteo-master will decrease coverage by 0.19%.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff                @@
##           criteo-master      #40     +/-   ##
================================================
- Coverage          83.66%   83.46%   -0.2%     
================================================
  Files                 20       20             
  Lines               1010     1010             
================================================
- Hits                 845      843      -2     
- Misses               165      167      +2
Impacted Files Coverage Δ
R/tracking-server.R 96.22% <0%> (-3.78%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2960d56...1fd7881. Read the comment docs.

conda_path = yaml_obj.get("conda_env")
if conda_path and docker_env:
raise ExecutionException("Project cannot contain both a docker and "
"conda environment.")

@t-henri t-henri Dec 4, 2019

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am not sure you should remove this part. I think the #CRITEO part below is what you intend to keep only in our fork ? So when you will do the PR upstream you should leave this part so the check that there is no conda + docker env is still done.

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.

No, the purpose of the #CRITEO comments is to provide guidance to people when doing merges from the mlflow repo. When this PR is submitted in the official mlflow repo, this comments should disappear.

"conda environment.")
conda_env = yaml_obj.get("conda_env")

# CRITEO

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why do you want to keep the pex env support only for Criteo ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

+2
Conda could work also with yarn. What about to split the review and do a specific one to add pex support in mlflow ?

Comment thread mlflow/projects/__init__.py Outdated

tracking.MlflowClient().set_tag(active_run.info.run_id,
yarn.MLFLOW_YARN_APPLICATION_ID,
submitted_run._skein_app_id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What is the point of this first tag ? If I understand correctly it is the same as the other one but with mlflow. before so it won't appear in the UI, couldn't we just remove it ?

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.. I think this is a left over of the 1st version of the implementation on which I had no clue how the "mlflow.*" tags operated.

will remove

Comment thread mlflow/projects/yarn.py Outdated
yarn_config = backend_config.copy()

for cfg_key in [YARN_NUM_CORES, YARN_MEMORY, YARN_QUEUE,
YARN_HADOOP_FILESYSTEMS, YARN_HADOOD_CONF_DIR,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Typo here: YARN_HADOOD_CONF_DIR

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.

fixed in c8f11f0

Comment thread mlflow/projects/yarn.py Outdated
YARN_MEMORY = 'memory'
YARN_QUEUE = 'queue'
YARN_HADOOP_FILESYSTEMS = 'hadoop_filesystems'
YARN_HADOOD_CONF_DIR = 'hadoop_conf_dir'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Typo: YARN_HADOOD_CONF_DIR

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.

fixed in c8f11f0

Comment thread mlflow/projects/yarn.py Outdated
YARN_MEMORY: "1 GiB",
YARN_QUEUE: "defautl",
YARN_HADOOP_FILESYSTEMS: '',
YARN_HADOOD_CONF_DIR: '',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Typo: YARN_HADOOD_CONF_DIR

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.

fixed in c8f11f0

Comment thread mlflow/projects/yarn.py Outdated
memory=yarn_config[YARN_MEMORY],
queue=yarn_config[YARN_QUEUE],
hadoop_file_systems=yarn_config[YARN_HADOOP_FILESYSTEMS].split(','),
hadoop_conf_dir=yarn_config[YARN_HADOOD_CONF_DIR],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Typo: YARN_HADOOD_CONF_DIR

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.

fixed in c8f11f0

Comment thread mlflow/projects/yarn.py Outdated
if app_state == skein.model.FinalStatus.SUCCEEDED:
return RunStatus.FINISHED
elif app_state == skein.model.FinalStatus.KILLED:
return RunStatus.KILLEDs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

extra 's' here

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.

fixed in c8f11f0

@t-henri

t-henri commented Dec 4, 2019

Copy link
Copy Markdown

I left a few comments, and I also think you should add some tests for Yarn projects like the ones for kubernetes (see tests/projects/test_kubernetes.py)

Comment thread mlflow/projects/yarn.py Outdated

class YarnSubmittedRun(SubmittedRun):
"""
Documentation goes here

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You should add the documentation here

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.

fixed in c8f11f0

@vguerra

vguerra commented Dec 4, 2019

Copy link
Copy Markdown
Author

thanks for the review @t-henri .. yes.. indeed two things still missing for this:

  • unit tests for all changes ( project file, SubmitteedRun, etc )
  • changes in documentation to explain the feature

I think i'll do the testing part for this review and leave the docu changes for a next PR.

Comment thread docs/source/projects.rst Outdated
Comment thread docs/source/projects.rst Outdated
Comment thread docs/source/projects.rst
Comment thread mlflow/projects/yarn.py Outdated
Comment thread docs/source/projects.rst
When an MLflow Project specifies a pex environment, it is shipped on the cluster.

You can specify a Pex environment for your MLflow project by including a ``pex_env`` entry in your
``MLproject`` file. It correspond to the path on the local filesystem or on hdfs where the pex can be found.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As far I understand, it should support any type of mlflow path.... so if pex is on http is ok too
I would say only path and remove local and hdfs part of the sentence

Comment thread docs/source/projects.rst
The queue to submit the application to.
- ``hadoop_filesystems``
List of Hadoop file systems to acquire delegation tokens for.
- ``hadoop_conf_dir``

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could be optional and use HADOOP_CONF_DIR if set ?

"conda environment.")
conda_env = yaml_obj.get("conda_env")

# CRITEO

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

+2
Conda could work also with yarn. What about to split the review and do a specific one to add pex support in mlflow ?

Comment thread mlflow/projects/yarn.py
Comment on lines +49 to +52
kind_of_script = command_parts.pop(0)
if 'python' != kind_of_script:
raise ExecutionException("Running on YARN backend supports only python jobs. "
"You are using '%s'" % (kind_of_script))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AFAIK it is a limitation of pex not yarn. I suggest to remove it (and make separate review for pex and try to fix it differently)

Comment thread mlflow/projects/yarn.py
env.update(
{
'SKEIN_CONFIG': './.skein',
'PEX_ROOT': "./.pex",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same it is pex relative... that's an option to inject in pex mode only

Comment thread mlflow/projects/yarn.py
)


def _is_hdfs_path(path):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

har ?
I am pretty sure the prefix => hdfs are already registred in mlflow elsewhere. Could you reuse it.

(and BTW, you can even imagine to use yarn without hdfs)

Comment thread mlflow/projects/yarn.py
Comment on lines +132 to +133
python_bin = "./%s" % os.path.basename(pex_env) if pex_env.endswith(
'.pex') else "./%s/bin/python" % os.path.basename(pex_env)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same Remove it now... let's see how to manage pex more globaly

Comment thread mlflow/projects/yarn.py
Comment on lines +130 to +131
dict_files_to_upload = {os.path.basename(path): os.path.abspath(path)
if not _is_hdfs_path(path) else path for path in additional_files}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pretty sure skein can manage out of the box hdfs path.... filter is useless for me.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.46%. Comparing base (cb0a421) to head (1fd7881).
⚠️ Report is 1329 commits behind head on criteo-master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@                Coverage Diff                @@
##           criteo-master      #40      +/-   ##
=================================================
- Coverage          83.66%   83.46%   -0.20%     
=================================================
  Files                 20       20              
  Lines               1010     1010              
=================================================
- Hits                 845      843       -2     
- Misses               165      167       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants