Commit Graph
56 Commits
Author SHA1 Message Date
Alexander Schepanovski e5e29065c8 api: make .open() stream data for Azure
This employs generating temporary signed public url and then streaming
from it. The bulk of the code might be reused for other remotes.

Url streaming does resume on connection error using "Range" header and
regenerates public url too.

If remote class doesn't provide .open() then this falls back to pulling
a file and opening it locally.
2019-08-09 21:51:43 +07:00
Alexander Schepanovski 50b5b87304 dvc: batch push/pull/fetch/status
This will speed up cache collection and then run single cloud op for all
collected cache.

Fixes #2308.
2019-07-30 13:33:01 +03:00
Alexander Schepanovski 59eb929516 ssh: do not ask for same password repeatedly 2019-07-23 16:25:40 +03:00
Alexander Schepanovski 35a8d69c4f dvc: ignore Stage.meta in md5 calculations
Meta change surely should not trigger a repro run. Closes #2209.
2019-07-23 16:00:22 +03:00
Alexander Schepanovski f00a325114 dvc: refactor dict_md5()
- stop using mutable default value
- use list and dict comprehensions to speed it up and make nicer
- employ exhaustive if..elif..else
2019-07-23 16:00:12 +03:00
Alexander Schepanovski 20f1976e03 remote: fixed Repo.push/pull/fetch/status() to default to 1 job 2019-07-23 12:23:43 +03:00
Alexander Schepanovski f37ab9431b perf: stop on first changed thing in Stage.changed() 2019-07-23 15:29:49 +07:00
Alexander Schepanovski 1f90b426fb remote: prettify get_connection/pool() signatures 2019-07-21 13:41:04 +07:00
Alexander Schepanovski 6afc2a38ba test: close pools on tests cleanup
This avoids weird errors as pools are collected by gc in broken env.
2019-07-21 13:40:29 +07:00
Alexander Schepanovski 31f1ded315 remote: don't close sftp connections until parent ssh conn closed
Since this is multiplexing over the same TCP connection no system
resources are withheld, so this should be a no-brainer optimization.

As a side-effect this should fix "open max - close all - try open -
Administratively prohobited" error @darabi experiencing in #2280.
2019-07-21 13:38:44 +07:00
Alexander Schepanovski 624ccfc744 remote: honor --jobs for status collection 2019-07-21 12:50:35 +07:00
Alexander Schepanovski 67e50cd71e remote: speed up ssh dir checksum 2019-07-18 22:13:42 +07:00
Alexander Schepanovski ed387d824d remote: do not swallow exceptions by ssh pool 2019-07-17 22:20:43 +07:00
Alexander Schepanovski 6010ce54cd remote: manually close all ssh pools at the end
Python 2 fails to do it automatically occasionally and shows weird error
messages.

This was harmless but confusing.
2019-07-17 22:20:43 +07:00
Alexander Schepanovski db19957b8a Download refactor (#2275)
* remote: drop not working http resume

Closes #2136

* remote: drop @transfer_context()

It is not needed for ssh anymore and GS/S3 are switched to client
instances in cached properties.

* remote: drop upload/download chunking
2019-07-16 16:27:44 +03:00
Alexander Schepanovski 9766d34cec remote: support older linuxes as ssh remotes (#2276)
* remote: support older linuxes as ssh remotes

Work around md5sum not having --tag in Red Hat 6.3 and friends.
Fixes #2242.

* remote: optimize consequent ssh md5 calls
2019-07-16 14:15:28 +03:00
Alexander Schepanovski b5a26e5853 remote: fix collect dir progress (#2270)
We were resolving futures after ThreadPoolExecutor exited and finished
everything.
2019-07-15 18:31:19 +03:00
Alexander Schepanovski b9a3c7c038 remote: use ssh connections pool (#2264)
* remote: use ssh connections pool

* dvc: never use paramiko DEBUG mode

It's ridiculously verbose, makes logs unreadable.
2019-07-14 23:30:24 +03:00
Alexander Schepanovski 732fd01cc5 test: drop a reimport (#2247) 2019-07-10 03:24:59 +03:00
Alexander Schepanovski 90b1a80240 test: test ssh dir output (#2246) 2019-07-10 03:24:35 +03:00
Alexander Schepanovski 16c16d334b dvc: skip unused checks in repro -f (#2245) 2019-07-10 03:22:07 +03:00
Alexander Schepanovski 14ce9d6d4a dvc: stop trying to fetch from remote when looking for git object (#2241)
Closes #2213
2019-07-08 17:57:25 +03:00
Alexander Schepanovski c4836b4578 dvc: optmize PathInfo.isin()
Should help with #2203
2019-07-05 13:18:12 +07:00
Alexander Schepanovski 7180f49df3 remote: fix UrlInfo.relative_to() 2019-07-04 22:43:24 +07:00
Alexander Schepanovski 89428db0f4 remote: optimize UrlInfo.isin()
This will use cached `_path`, which will use cached `_cparts`. Saves
some time skipping repetitive parsing.
2019-07-04 22:39:05 +07:00
Alexander Schepanovski 4934a3b2fe dvc: fix #2219 2019-07-04 19:51:27 +07:00
Alexander Schepanovski be1d696188 dvc: fix prompt message while collecting used cache 2019-07-03 14:43:31 +07:00
Alexander Schepanovski 835a04a186 remote: fix ssh dir outputs 2019-07-02 18:49:19 +07:00
Alexander Schepanovski 30304c3454 remote: always ignore ENOENT in ssh.rmdir() 2019-07-02 18:49:10 +07:00
Alexander Schepanovski 766b7d8818 dvc: uninstall external repo properly 2019-07-01 19:08:50 +07:00
Alexander Schepanovski 9ba54c1f56 dvc: add rev param to api.open()/read()/get_url() 2019-07-01 14:40:48 +07:00
Alexander Schepanovski 3187040fe8 dvc: raise when Repo.open() fails 2019-07-01 14:40:48 +07:00
Alexander Schepanovski 480eb0a077 Optimize ssh makedirs 2019-06-28 15:31:10 +07:00
Alexander Schepanovski 0ffd52a836 remote: fix ssh makedirs race
Closes #1862
2019-06-28 15:30:54 +07:00
Alexander Schepanovski bdd5ca48da dvc: fix relpath()
- accept Path-like object as start in Python3.5-
- always return str

Closes #2188.
2019-06-26 15:19:22 +07:00
Alexander Schepanovski 6e761c7e7a dvc: check stage name before running command
Closes #2150.
2019-06-25 19:21:16 +07:00
Alexander Schepanovski 4d248b4183 dvc: support external repos in api functions 2019-06-25 13:08:03 +07:00
Alexander Schepanovski db75693fe1 dvc: return non zero error code on push/pull/fetch error
Closes #2038
2019-06-14 23:25:39 +07:00
Alexander Schepanovski 80ca3eedc8 dvc: unify remote upload/download code
Bugs fixed along the way:
- unable to copy between buckets in GS
- unneeded connection init in RemoteGS.copy()
- connection not closed on some errors in RemoteSSH.download()
- inconsistent progress bar handling
2019-06-14 12:13:11 +07:00
Alexander Schepanovski d80293c44d dvc: path info refactoring
Replaced Path* dataclasses with PathInfo/URLInfo/CloudURLInfo, which
know how parse, serialize, stringify and join themselves. They also
provide useful accessors like part of an url or pathlib.Path like
.parent or .name.

Along the way two families of bugs where fixed and should never occur in
the future:
- paths not matched as strings anymore, e.g. using str.startswith()
- Output.path is eliminated as ambiguous

Both families might had caused undefined surprising behavior when local
and remote paths clash.
2019-06-11 19:19:17 +07:00
Alexander Schepanovski ca93dbcf13 dvc: add get_url()/open() API
As a part of this:
- DataCloud._cloud was refactored into `.get_remote()`
- data stopped using internal _cloud
- added a parametrization for remote tests
2019-05-27 17:56:31 +07:00
Alexander Schepanovski eac6adada6 dvc: fix HDFS path 2019-05-25 17:55:23 +07:00
Alexander Schepanovski 7ddbbbc80f test: simplify google creds handling 2019-05-25 17:55:23 +07:00
Alexander Schepanovski 0e1f20f0f5 test: update/add helpers to run tests against remotes 2019-05-21 17:38:53 +07:00
Alexander Schepanovski 7943add4c8 test: skip data cloud cli tests properly, don't say passed 2019-05-02 17:47:42 +07:00
Alexander Schepanovski 6e0e5b426b test: never run updater nor analytics in tests
Previously that was only the case when running tests via `python
-mtests` wrapper.
2019-05-01 13:48:57 +07:00
Alexander Schepanovski a6823e0113 dvc: add progress bar when hashing a large dir
Added an easier way to show progress bar over for loops.
2019-04-30 20:26:02 +07:00
Alexander Schepanovski af4af45458 test: dedup some metrics tests
Closes #1928.
2019-04-30 18:01:54 +07:00
Alexander Schepanovski cdf318fff7 test: abandon default DEBUG log level in tests
Now simple `py.test` command won't use DEBUG log level and `py.test ...
--log-level=LEVEL` will do what it's supposed to.

Staging continues to use DEBUG log level.

This is part of #1888 resolution.
2019-04-30 17:43:39 +07:00
Alexander Schepanovski 7d067f78b2 test: fix tests being dependent on log level
Note we call main() to spare process overhead, this leads to main()
inheriting log level and later tests inheriting whatever main() run
left. This makes main to behave.
2019-04-30 17:33:49 +07:00
Alexander Schepanovski cdba077b61 dvc: some minor optimizations 2019-04-26 19:10:08 +07:00
Alexander Schepanovski 7478e7d4b0 test: clean up test dirs (#1904)
* test: clean up test dirs

Closes #1770. Partially does #1888.

* dvc: close anything opened

* test: finalize git repo explicitly to remove test dir later

This was previously an issue on Windows.
2019-04-25 14:55:39 +03:00
Alexander Schepanovski ee8d9a1312 dvc: improve apply_diff() docstring
- explain how it works and why is it needed
- fix typo
2019-04-24 02:45:02 +03:00
Alexander Schepanovski 277b9e566c test: use caplog.at_level() to restore log level after test 2019-04-24 02:45:02 +03:00
Alexander Schepanovski 8ef52f92ee dvc: add meta key to stages to store user data 2019-04-22 16:26:57 +03:00
Alexander Schepanovski 0c867399bb dvc: retain formatting and comments in .dvc files (#1885)
* test: remove never used copy of load_stage_file()

* dvc: save comments and custom formatting in stage files

* Add a couple of TODOs

* test: test repro doesn't clear comments and formatting in .dvc

As part of this I started writing pytest-like tests and added commonly
used fixtures.

* test: simplify and prettify dvc formatting retained test

Also test that line comments after md5 fields are retained.

* test: fix tests

* dvc: fix stage and metrics opens not closed

* dvc: always use utf-8 in stage files

It used to encode in system default encoding. Not sure if PyYAML was
handling this silently or we were just lucky all the way.

* test: unit test apply_diff()

* test: remove TODOs and ASK

* dvc: polish dvc-formatting PR

* dvc: move stage load/dump utils to a new stage utils file

* dvc: clean up apply_diff()

* test: test stage md5 ignores comments

* test: remove pytests starting marker
2019-04-20 01:12:53 +03:00