mahout.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. """
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. Ambari Agent
  16. """
  17. import os
  18. from resource_management import *
  19. def mahout():
  20. import params
  21. Directory( params.mahout_conf_dir,
  22. create_parents = True,
  23. owner = params.mahout_user,
  24. group = params.user_group
  25. )
  26. XmlConfig("yarn-site.xml",
  27. conf_dir=params.hadoop_conf_dir,
  28. configurations=params.config['configurations']['yarn-site'],
  29. configuration_attributes=params.config['configuration_attributes']['yarn-site'],
  30. owner=params.yarn_user,
  31. group=params.user_group,
  32. mode=0644
  33. )
  34. if not is_empty(params.log4j_props):
  35. File(format("{params.mahout_conf_dir}/log4j.properties"),
  36. mode=0644,
  37. group=params.user_group,
  38. owner=params.mahout_user,
  39. content=params.log4j_props
  40. )
  41. elif (os.path.exists(format("{params.mahout_conf_dir}/log4j.properties"))):
  42. File(format("{params.mahout_conf_dir}/log4j.properties"),
  43. mode=0644,
  44. group=params.user_group,
  45. owner=params.mahout_user
  46. )