https://pantsbuild.org/ logo
#general
Title
# general
w

witty-crayon-22786

03/18/2016, 8:11 PM
Copy code
from pants.backend.jvm.targets.exclude import Exclude
from pants.backend.jvm.targets.jvm_binary import JarRules, JvmBinary


# The hadoop cluster provides the appropriate versions of these jars.
ON_HADOOP_CLUSTER_EXCLUDES = [
    Exclude('org.slf4j'),
    Exclude('commons-httpclient','commons-httpclient'),
    Exclude('org.apache', 'hadoop-core'),
    Exclude('org.apache', 'hadoop-lzo'),
    Exclude('com.hadoop', 'hadoop-lzo'),
    Exclude('org.apache.hadoop'),
    Exclude('org.apache.hbase')
]

class TwitterHadoopBinary(JvmBinary):
  """A binary that is suitable for running on the Hadoop cluster.

  Invoking the ``binary`` or ``bundle`` goal on one of these targets creates a binary jar that
  excludes any dependencies already provided by the hadoop cluster.
  """
  def __init__(
      self,
      name,
      main,
      basename=None,
      source=None,
      resources=None,
      excludes=None,
      deploy_jar_rules=None,
      deploy_excludes=None,
      **kwargs):

    super(TwitterHadoopBinary, self).__init__(
        name=name,
        main=main,
        basename=basename,
        source=source,
        resources=resources,
        excludes=excludes,
        deploy_jar_rules=deploy_jar_rules,
        deploy_excludes=(deploy_excludes or []) + ON_HADOOP_CLUSTER_EXCLUDES,
        **kwargs)