Commit Graph
85 Commits
Author SHA1 Message Date
Alexander Schepanovski 329d072c22 perf: explain why two yaml parsers are used 2019-11-13 16:35:05 +01:00
Alexander Schepanovski 58c9e5557c perf: optimize yaml parsing for stages 2019-11-11 13:41:50 +01:00
Alexander Schepanovski b83564d80e perf: refactor URLInfo to not use ParseResult inside
This permites URLInfo construction from parts without building/reparsing
string, which makes it around 20% faster. Code is also simpler and a bit
shorter now.

Other improvements:
- added URLInfo.replace(path=...)
- URLInfo._path now stringifies properly
- protected against passing path not starting with /
- do not allow query, params, fragments and passwords in urls (they were
silently ignored previously)
2019-11-01 17:33:00 +01:00
Alexander Schepanovski 77fcd49695 dvc: fix tqdm dep (#2694)
tqdm==4.35.0 was throwing KeyError: 'percentage'.
2019-10-30 16:43:18 +02:00
Alexander Schepanovski 86811aac20 imp: dedup and parallelize fetching imported deps (#2654)
* imp: dedup and parallelize external fetches

This prevents same fetches for external artifacts, groups them by source
and fetches in parallel.

* imp: test that fetch works on non workspace deps
2019-10-23 18:02:50 +03:00
Alexander Schepanovski 30341438e0 gc: added --all-commits (#2643)
* dvc: fix branch suffixes in status/push/pull

* gc: add --all-commits flag

* gc: fix gc warning

Say that we always leave things used in the working tree
2019-10-23 18:00:31 +03:00
Alexander Schepanovski 33b0eefec0 dvc: dedup used cache (#2630)
* dvc: dedup used cache

This is a preparation step to make garbage collector work with more
commits. It has a value of its own:
- less exists calls to show cloud status or prepare push/pull
- same names are not repeated in status and pbar texts

* dvc: delay checksum names concatenation
2019-10-21 12:12:56 +03:00
Alexander Schepanovski 1f58fc6f42 dvc: dedup brancher (#2639) 2019-10-20 17:32:42 +03:00
Alexander Schepanovski c26233acbb dvc: reset dvcignore
This depends on filesystem and affects stages collection so must be
reset.
2019-10-13 19:18:53 +07:00
Alexander Schepanovski 44264857c3 ui/perf: do not clone same repo multiple times (#2583)
* ui/perf: do not clone same repo multiple times

Closes #2490

External repos are still created in /tmp. They might be reused until
main() end. If no perfect match is found then a repo with the same url
is copied (not cloned again) and adjusted to fit a request: rev and
cache_dir.

NOTE: test_download_error_pulling_imported_stage() was modified to not
rely on clone error.

* test: fix import update test

* test: fix external_repo test under Windows

* dvc: fix non-master default branch for external repos

* dvc: remove unused .unset_dir() method
2019-10-11 13:56:37 +03:00
Alexander Schepanovski 0203fd4017 perf: import dvc.repo dynamically 2019-09-27 15:08:42 +07:00
Alexander Schepanovski e2eb4ae0c3 perf: delay cache creation
The older code instantiates non-local cache remotes on Repo creation if
any of those are configured. And remote instantiation loads their API
libs.
2019-09-24 09:03:03 +07:00
Alexander Schepanovski 4006c6434e dvc: remove dead code in DataCloud 2019-09-23 20:00:19 +07:00
Alexander Schepanovski cb5ff6e085 perf: import some things later
Saves on startup time
2019-09-20 16:45:02 +07:00
Alexander Schepanovski ffb52b256b perf: do not import http.server each run
It is only used in tests.
2019-09-17 18:41:05 +07:00
Alexander Schepanovski eac0aa13b2 perf: use packaging.version instead of pkg_resources
This is the same functionality without a cost of loading a huge package.
2019-09-17 14:32:31 +07:00
Alexander Schepanovski 293a50d75c perf: use fast entry points on non-wheel install
This avoids importing `pkg_resources` on startup, which saves around 200
ms.

NOTE: wheel installer uses its own entry points template, which is the same
fastentrypoints.py script provides, so no gain there.
2019-09-12 22:33:59 +07:00
Alexander Schepanovski 3c3378bdca dvc: make lock lifetime long by default 2019-09-11 14:21:12 +07:00
Alexander Schepanovski d9d85f3cb0 dvc: fix locks in Python2.7/Windows
Return to zc.lockfile lock in Python 2, NFS is not supported there
anyway since sqlite3 doesn't support URIs.
2019-09-11 14:17:21 +07:00
Alexander Schepanovski f29f07ca88 dvc: do not lock sqlite db 2019-09-11 14:17:16 +07:00
Alexander Schepanovski 6aeccfcc07 dvc: fix long lock filenames under Windows 2019-09-06 16:29:23 +07:00
Alexander Schepanovski 1bdaca0d6c dvc: switch to flufl lock
This locks employs hardlink trick, which works on NFS and alike unlike
fcntl/open locks.

Closes #1918.
2019-09-06 16:29:09 +07:00
Alexander Schepanovski b52265a1d2 ui: remove extraneous stage.save()
stage.update() already does that via .run(). That was causing printing a
confusing message to user.
2019-08-27 15:04:37 +07:00
Alexander Schepanovski c68b76f843 ui: remove "Reproducing ..." message
It as always followed by a more specific one, so it's superfluous.
2019-08-27 15:02:21 +07:00
Alexander Schepanovski edcd1724b4 cache: skip non-checksum files around cache
Fixes #2394
2019-08-24 15:04:25 +07:00
Alexander Schepanovski 8984e9fed4 dvc: use wdir == "." on add
Fixes #2404
2019-08-24 10:23:41 +07:00
Alexander Schepanovski 85289ad00b api: wrap not found errors
api.open()/read() will now raise OutputFileMissingError and
Remote*.open() will raise FileNotFoundError if target file is absent.
2019-08-15 23:20:48 +07:00
Alexander Schepanovski 60a983b63f api: stream api.open() for local, SSH and HDFS 2019-08-13 18:19:52 +07:00
Alexander Schepanovski 641eb57b27 api: stream data in api.open() for S3, GS and OSS
Employ the same sign url and use resumable download approach tested for
Azure.
2019-08-13 14:09:51 +07:00
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