submit_azureml_pytest_3.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. def create_run_config(cpu_cluster, docker_proc_type, conda_env_file):
  2. """
  3. AzureML requires the run environment to be setup prior to submission.
  4. This configures a docker persistent compute. Even though
  5. it is called Persistent compute, AzureML handles startup/shutdown
  6. of the compute environment.
  7. Args:
  8. cpu_cluster (str) : Names the cluster for the test
  9. In the case of unit tests, any of
  10. the following:
  11. - Reco_cpu_test
  12. - Reco_gpu_test
  13. docker_proc_type (str) : processor type, cpu or gpu
  14. conda_env_file (str) : filename which contains info to
  15. set up conda env
  16. Return:
  17. run_amlcompute : AzureML run config
  18. """
  19. # runconfig with max_run_duration_seconds did not work, check why:
  20. # run_amlcompute = RunConfiguration(max_run_duration_seconds=60*30)
  21. run_amlcompute = RunConfiguration()
  22. run_amlcompute.target = cpu_cluster
  23. run_amlcompute.environment.docker.enabled = True
  24. run_amlcompute.environment.docker.base_image = docker_proc_type
  25. # Use conda_dependencies.yml to create a conda environment in
  26. # the Docker image for execution
  27. # False means the user will provide a conda file for setup
  28. # True means the user will manually configure the environment
  29. run_amlcompute.environment.python.user_managed_dependencies = False
  30. run_amlcompute.environment.python.conda_dependencies = CondaDependencies(
  31. conda_dependencies_file_path=conda_env_file)
  32. return run_amlcompute