How to use the hdfs.__main__.main function in hdfs

To help you get started, we’ve selected a few hdfs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mtth / hdfs / test / test_main.py View on Github external
def test_download_stream(self):
    self.client.write('foo', 'hello')
    with temppath() as tpath:
      stdout = sys.stdout
      try:
        with open(tpath, 'wb') as writer:
          sys.stdout = writer
          main(
            ['download', 'foo', '-', '--silent', '--threads', '1'],
            self.client
          )
      finally:
        sys.stdout = stdout
      with open(tpath) as reader:
        eq_(reader.read(), 'hello')
github mtth / hdfs / test / test_main.py View on Github external
def test_upload_force(self):
    self.client.write('bar', 'hey')
    main(
      ['upload', self.dpath, 'bar', '--silent', '--threads', '1', '--force'],
      self.client
    )
    with temppath() as tpath:
      self.client.download('bar', tpath)
      self._dircmp(tpath)
github mtth / hdfs / test / test_main.py View on Github external
def test_download_force(self):
    self.client.write('foo', 'hey')
    with temppath() as tpath:
      with open(tpath, 'w'):
        pass
      main(
        ['download', 'foo', tpath, '--silent', '--force', '--threads', '1'],
        self.client
      )
      with open(tpath) as reader:
        eq_(reader.read(), 'hey')
github mtth / hdfs / test / test_main.py View on Github external
def test_upload_overwrite(self):
    self.client.write('bar', 'hey')
    main(
      ['upload', self.dpath, 'bar', '--silent', '--threads', '1'],
      self.client
    )
github mtth / hdfs / test / test_main.py View on Github external
def test_download_stream_multiple_files(self):
    self.client.upload('foo', self.dpath)
    main(
      ['download', 'foo', '-', '--silent', '--threads', '1'],
      self.client
    )
github mtth / hdfs / test / test_main.py View on Github external
def test_upload_append(self):
    with temppath() as tpath:
      with open(tpath, 'w') as writer:
        writer.write('hey')
      main(['upload', tpath, 'bar', '--silent', '--threads', '1'], self.client)
      main(
        ['upload', tpath, 'bar', '--silent', '--threads', '1', '--append'],
        self.client
      )
    with self.client.read('bar') as reader:
      eq_(reader.read(), b'heyhey')
github mtth / hdfs / test / test_main.py View on Github external
def test_upload(self):
    main(
      ['upload', self.dpath, 'bar', '--silent', '--threads', '1'],
      self.client
    )
    with temppath() as tpath:
      self.client.download('bar', tpath)
      self._dircmp(tpath)
github mtth / hdfs / test / test_main.py View on Github external
def test_download_overwrite(self):
    self.client.upload('foo', self.dpath)
    with temppath() as tpath:
      with open(tpath, 'w'):
        pass
      main(
        ['download', 'foo', tpath, '--silent', '--threads', '1'],
        self.client
      )
      self._dircmp(tpath)
github mtth / hdfs / test / test_main.py View on Github external
def test_upload_append_folder(self):
    with temppath() as tpath:
      main(['upload', self.dpath, '--silent', '--append'], self.client)
github mtth / hdfs / test / test_main.py View on Github external
def test_download(self):
    self.client.upload('foo', self.dpath)
    with temppath() as tpath:
      main(
        ['download', 'foo', tpath, '--silent', '--threads', '1'],
        self.client
      )
      self._dircmp(tpath)