Introduces support to launch MLflow Projects on YARN.#40
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
| conda_path = yaml_obj.get("conda_env") | ||
| if conda_path and docker_env: | ||
| raise ExecutionException("Project cannot contain both a docker and " | ||
| "conda environment.") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Why do you want to keep the pex env support only for Criteo ?
There was a problem hiding this comment.
+2
Conda could work also with yarn. What about to split the review and do a specific one to add pex support in mlflow ?
|
|
||
| tracking.MlflowClient().set_tag(active_run.info.run_id, | ||
| yarn.MLFLOW_YARN_APPLICATION_ID, | ||
| submitted_run._skein_app_id) |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
| yarn_config = backend_config.copy() | ||
|
|
||
| for cfg_key in [YARN_NUM_CORES, YARN_MEMORY, YARN_QUEUE, | ||
| YARN_HADOOP_FILESYSTEMS, YARN_HADOOD_CONF_DIR, |
| YARN_MEMORY = 'memory' | ||
| YARN_QUEUE = 'queue' | ||
| YARN_HADOOP_FILESYSTEMS = 'hadoop_filesystems' | ||
| YARN_HADOOD_CONF_DIR = 'hadoop_conf_dir' |
| YARN_MEMORY: "1 GiB", | ||
| YARN_QUEUE: "defautl", | ||
| YARN_HADOOP_FILESYSTEMS: '', | ||
| YARN_HADOOD_CONF_DIR: '', |
| 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], |
| if app_state == skein.model.FinalStatus.SUCCEEDED: | ||
| return RunStatus.FINISHED | ||
| elif app_state == skein.model.FinalStatus.KILLED: | ||
| return RunStatus.KILLEDs |
|
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) |
|
|
||
| class YarnSubmittedRun(SubmittedRun): | ||
| """ | ||
| Documentation goes here |
|
thanks for the review @t-henri .. yes.. indeed two things still missing for this:
I think i'll do the testing part for this review and leave the docu changes for a next PR. |
As well, project file now can take path to a pex file to be used for runs launched in YARN. Fixing linter issues.
…in MLflowProject file. As well, adding a check for the pex_env file path to make sure it exists.
Adding testing resources for yarn unit tests.
| 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. |
There was a problem hiding this comment.
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
| The queue to submit the application to. | ||
| - ``hadoop_filesystems`` | ||
| List of Hadoop file systems to acquire delegation tokens for. | ||
| - ``hadoop_conf_dir`` |
There was a problem hiding this comment.
Could be optional and use HADOOP_CONF_DIR if set ?
| "conda environment.") | ||
| conda_env = yaml_obj.get("conda_env") | ||
|
|
||
| # CRITEO |
There was a problem hiding this comment.
+2
Conda could work also with yarn. What about to split the review and do a specific one to add pex support in mlflow ?
| 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)) |
There was a problem hiding this comment.
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)
| env.update( | ||
| { | ||
| 'SKEIN_CONFIG': './.skein', | ||
| 'PEX_ROOT': "./.pex", |
There was a problem hiding this comment.
Same it is pex relative... that's an option to inject in pex mode only
| ) | ||
|
|
||
|
|
||
| def _is_hdfs_path(path): |
There was a problem hiding this comment.
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)
| python_bin = "./%s" % os.path.basename(pex_env) if pex_env.endswith( | ||
| '.pex') else "./%s/bin/python" % os.path.basename(pex_env) |
There was a problem hiding this comment.
Same Remove it now... let's see how to manage pex more globaly
| 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} |
There was a problem hiding this comment.
pretty sure skein can manage out of the box hdfs path.... filter is useless for me.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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?
(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?
How should the PR be classified in the release notes? Choose one:
rn/breaking-change- The PR will be mentioned in the "Breaking Changes" sectionrn/none- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionrn/feature- A new user-facing feature worth mentioning in the release notesrn/bug-fix- A user-facing bug fix worth mentioning in the release notesrn/documentation- A user-facing documentation change worth mentioning in the release notes