I'm trying to learn to use mlflow
by creating a very simple project and log it.
I've tried following mlflow
's example and my code runs properly when running the main.py as a normal bash command.
I couldn't make it run using the mlflow
CLI using project and a simple file.
I got the following error.
(rlearning) yair@pc2016:~/reinforced_learning101$ mlflow run src/main.py
2019/05/11 10:21:41 ERROR mlflow.cli: === Could not find main among entry points [] or interpret main as a runnable script. Supported script file extensions: ['.py', '.sh'] ===
(rlearning) yair@pc2016:~/reinforced_learning101$ mlflow run .
2019/05/11 10:40:25 INFO mlflow.projects: === Created directory /tmp/tmpe26oernf for downloading remote URIs passed to arguments of type 'path' ===
2019/05/11 10:40:25 INFO mlflow.projects: === Running command 'source activate mlflow-21497056aed7961402b515847613ed9f950fa9fc && python src/main.py 1.0' in run with ID 'ed51446de4c44903ab891d09cfe10e49' ===
bash: activate: No such file or directory
2019/05/11 10:40:25 ERROR mlflow.cli: === Run (ID 'ed51446de4c44903ab891d09cfe10e49') failed ===
Needless to say my main has a .py
suffix.
Is there anything wrong that causes this issue?
My main.py is:
import sys
import gym
import mlflow
if __name__ == '__main__':
env = gym.make("CartPole-v0")
right_percent = float(sys.argv[1]) if len(sys.argv) > 1 else 1.0
with mlflow.start_run():
obs = env.reset()
print(env.action_space)
action = 1 # accelerate right
print(obs)
mlflow.log_param("right percent", right_percent)
mlflow.log_metric("mean score", 1)
mlflow.log_metric("std score", 0)
conda_env.yaml
name: rlearning
channels:
- defaults
dependencies:
- python=3.7
- numpy
- pandas
- tensorflow-gpu
- pip:
- mlflow
- gym
MLproject
name: reinforced learning
conda_env: files/config/conda_environment.yaml
entry_points:
main:
parameters:
right_percent: {type: float, default: 1.0}
command: "python src/main.py {right_percent}"