Commit Graph
100 Commits
Author SHA1 Message Date
skshetry f062b52e05 Add python version label to the readme (#8146) 2022-08-18 18:34:58 +05:45
skshetry 7a0b3e9377 Update tests/func/experiments/test_queue.py 2022-08-09 17:50:48 +08:00
skshetry 7c1e339650 data status: handle path joining properly for tree leaves/items (#8107) 2022-08-09 09:34:15 +05:45
skshetry 6f0736142b deps: bump dvc-data to 0.1.6 2022-07-28 21:45:23 +05:45
Saugat Pachhai (सौगात) d0eda1d538 data status: add spinners during diff 2022-07-25 19:32:19 +05:45
Saugat Pachhai (सौगात) 896acedb07 data status: optimize printing status list
`--untracked-files` and `--unchanged` coupled with `--granular`
puts a lot of stress on `show_status`. Currently, with those options,
dvc spends ~26s on `_show_status` function.

Unhappy with the above result, I looked into improving the situation with
`console.out`. It did reduce that to 9s but it still felt like a lot.

Then I dropped to good old colorama, which dropped to 3s(term)/1.24(redirected).
I tested with buffering output which dropped this further to
~600ms(term)/~100ms(redirected).

This may seem like premature optimization, but this was preventing me
from figuring out perf issues in granular outputs, and I believe the
user should not be penalize for using feature that we already offer.
2022-07-25 17:47:23 +05:45
Saugat Pachhai (सौगात) fd7dcae8aa cli/log: handle SIGPIPE errors
`dvc <command> | head` for example could fail with SIGPIPE and
would print a traceback with BrokenPipeError exception. Now we
redirect do /dev/null in case of error as suggested in Python's
docs: https://docs.python.org/3/library/signal.html\#note-on-sigpipe.
2022-07-25 16:38:09 +05:45
Saugat Pachhai (सौगात) c3ac4f84bf data status: fix untracked files output for subdir 2022-07-22 16:29:04 +03:00
Saugat Pachhai (सौगात) 61729ff66a use M fixture for concise tests 2022-07-22 16:29:04 +03:00
Saugat Pachhai (सौगात) 3dfcb82e5c add tests for data:status command 2022-07-22 16:29:04 +03:00
Saugat Pachhai (सौगात) 340a158595 introduce new dvc data status command 2022-07-22 16:29:04 +03:00
skshetry dbfe88510f deps: bump dvc-data to 0.0.24 2022-07-15 22:40:26 +05:45
Saugat Pachhai (सौगात) a4c0ae9c73 deps: bump dvc-data, install dvc-data cli deps in dev mode 2022-07-10 18:37:38 +05:45
skshetry 3c76885577 deps: remove setuptools_scm_git_archive
setuptools_scm can now work with git archives, so we don't need this plugin.
2022-06-30 17:00:24 +05:45
skshetry be3ec9dc59 deps: bump dvc-data to 0.0.16 2022-06-29 20:16:19 +05:45
skshetry 3dcd0107d2 deps: bump dvc-data to 0.0.13 2022-06-23 14:04:16 +05:45
Saugat Pachhai (सौगात) 4bc6b5699a quote node names 2022-06-15 12:43:45 +03:00
Saugat Pachhai (सौगात) af649af462 deps: bump dvc-data to 0.0.6; fix imports 2022-06-14 17:50:57 +05:45
Saugat Pachhai (सौगात) 8e6ea87b76 typing: executor: use queue.Queue instead of multiprocessing.Queue 2022-06-13 21:41:54 +05:45
Saugat Pachhai (सौगात) 7b16a377e5 deps: bump dvc-data to 0.0.3 2022-06-13 18:03:53 +05:45
Saugat Pachhai (सौगात) d30dbd50bc run-cache: http: stage cache uploads in http remotes
Currently, there is no way to find run-cache in HTTP remotes.
In the future, we could use directory-listings from supported
webservers to find files.
Temporarily, we are restricting the run-cache uploads. This is a bit
strict, we could have only restricted the downloads, but it might be
more confusing to the users, so I went to categorically restrict
stage cache uploads and downloads for http filesystems.
2022-06-12 13:49:56 +03:00
Saugat Pachhai (सौगात) e6db6ffc89 runcache: fix push from Windows to remote filesystems
We were passing paths with '\\' in the filename instead of posix paths to
remote filesystems which was causing failures to upload.
Although in some filesystems, this was failing silently, so upload would seem
to have passed, but the download later would fail.
2022-06-11 11:34:12 +03:00
Saugat Pachhai (सौगात) 6dd3f1e053 deps: bump dvc-data to 0.0.3 2022-06-10 14:07:33 +05:45
Saugat Pachhai (सौगात) 1e77be3ae3 testing: use shutil.copytree with dirs_exist_ok
See https://docs.python.org/3/library/shutil.html#shutil.copytree.
There is dirs_exist_ok kwarg in Python >3.8.
2022-05-30 20:40:31 +05:45
Saugat Pachhai (सौगात) 68b0d61c9e tests: move run cache test to test_remote 2022-05-24 10:16:37 +05:45
Saugat Pachhai (सौगात) 942a080567 dvc.stage.cache: fix typo, was using src filesystem to transfer
This was working for LocalFileSystem as they work for any directories/path.
It's hard to test this these days, as we don't have remote tests inside
dvc, so it was not caught.

Potentially fixes #7718.
2022-05-23 16:37:40 +03:00
Saugat Pachhai (सौगात) 60cbcec399 formatting: consider dvc-render as a known first party for ordering imports 2022-05-23 15:49:47 +05:45
Saugat Pachhai (सौगात) 0c5a18513c fix linter issue 2022-05-23 14:12:54 +05:45
Saugat Pachhai (सौगात) 75fa487406 dvc: remove unused utils and redundant tests
The tests should be in dvc-objects repo npw, and will be migrated soon.
The nanotime and diskcache are specified in dvc-objects, so we don't need
those here.
2022-05-20 19:17:00 +05:45
Saugat Pachhai (सौगात) 0ecd47b333 deps: remove jaraco.windows dependency
This is used by dvc-objects, and it has the dependency declared.
2022-05-20 15:18:13 +05:45
Saugat Pachhai (सौगात) 9710cafd38 deps: add dvc-objects dependency 2022-05-20 15:13:50 +05:45
Saugat Pachhai (सौगात) e34767ca90 logging: show logs from dvc-data 2022-05-20 15:13:50 +05:45
Saugat Pachhai (सौगात) 9a2feaa4ed dvc: remove dvc.data, fix imports 2022-05-20 15:13:50 +05:45
Saugat Pachhai (सौगात) 7bc98e3fb3 tests: remove objects related tests 2022-05-20 14:02:08 +05:45
Saugat Pachhai (सौगात) 5e561c1dfd deps: add dvc-objects as a dependency 2022-05-20 14:02:08 +05:45
Saugat Pachhai (सौगात) 572b6dfca9 logging: show logs from dvc-objects 2022-05-20 14:02:08 +05:45
Saugat Pachhai (सौगात) 37921d618d dvc: remove dvc.objects, fix imports 2022-05-20 14:02:08 +05:45
Saugat Pachhai (सौगात) 95c6cea36d tests: restructure some tests for objects/data 2022-05-19 18:38:21 +05:45
Saugat Pachhai (सौगात) 455260b29c data/objects: reduce log levels in dvc-objects and dvc-data
Also introduces a `validate_status` kwarg in `data.transfer`,
which is used in dvc to log for missing version info.
2022-05-19 18:33:39 +05:45
Saugat Pachhai (सौगात) 82dc67d890 objects: use separate Tqdm implementations
Now dvc.objects and dvc.data uses the implementation from dvc.objects
for Tqdm progress bars. This is temporary. :)
2022-05-19 18:07:47 +05:45
Saugat Pachhai (सौगात) 2057c471bb data.checkout: remove dependency on DVC; prompts and DvcException 2022-05-19 15:11:27 +03:00
Saugat Pachhai (सौगात) f23d31af64 fs/data: move repo related utils to dvc
This moves get_fs_config/get_fs_cloud and ODBManager to DVC
as they require DVC related utilities, and we don't need them
strictly in dvc-objects/dvc-data.
This also adds support to ReferenceHashFile to load from
any filesystem, using it's module name and filename.
Now we can get rid of DVCFileSystem dependency in
ReferenceHashFile.
This is a temporary solution, we really need a registry.
(I am not quite sure if this works in pyinstaller mode,
but I think it should, it's how fsspec does it if I understand
correctly.)
2022-05-18 19:39:09 +03:00
Saugat Pachhai (सौगात) cf5d3830c5 dvc.objects: use own internal error instead of DvcException
transfer raises internal TransferError, merge raises internal MergeError
and local ODB raises ODBError on unprotect.
transfer's error is reraised to FileTransferError back in DataCloud.
2022-05-18 12:22:57 +03:00
Saugat Pachhai (सौगात) 32cd6c2c03 dvc.objects: use stub ignore in dvc.objects/dvc.data
This commit:
* defines a `Ignore` protocol in `dvc.objects`, that expects a `find` method.
  This will be used in dvc-data and dvc-objects instead of depending on dvc.ignore.
  dvcignore is expected to respect this protocol, which it does.
* renames `dvcignore` kwarg to `ignore` in `dvc-data` and `dvc-objects`.
* teaches dvc.cli that `IgnoreInCollectedError` is a known exception
   and is logged correctly and adds a test for the behaviour.

I am not happy that we need to hardcode `.dvcignore` in dvc-data
but I don't see any easy way, since we always try to avoid
staging if the tree contains .dvcignore file, even if .dvcignore
is not passed.
2022-05-18 12:22:28 +03:00
Saugat Pachhai (सौगात) 54917e3255 dvc.objects: fix typing imports 2022-05-18 11:49:45 +05:45
Saugat Pachhai (सौगात) 3872f79dad objects.fs: do not use format_link, DvcException and fix_env from DVC
* Introduce ConfigError and AuthError in dvc.objects.fs and raise it
  instead of dvc.config.ConfigError.
* Provide hints and links by catching those errors in dvc.cli.main,
  i.e decouple UI messages from filesystems for AuthError and
  ConfigError.
* Copy flatten/unflatten utils to dvc.objects.fs.utils.
2022-05-17 18:23:29 +03:00
Saugat Pachhai (सौगात) 48176b80f6 fs: do not use DvcException in filesystems
* Refactor check_requires, move UI messages to dvc.cli
* Refactor link related error
2022-05-17 16:48:38 +03:00
Saugat Pachhai (सौगात) 8c9a9e9a1f objects.fs: move schemes to objects.fs 2022-05-17 17:02:14 +05:45
Saugat Pachhai (सौगात) 120eb09c4d fs: move GitFileSystem out of dvc.objects.fs
This is more of a DVC thing than objects.
2022-05-17 16:50:33 +05:45
Saugat Pachhai (सौगात) bf7892012d objects.fs: copy executors to dvc.objects 2022-05-17 16:50:21 +05:45
Saugat Pachhai (सौगात) 36605eea4c objects.hash: rename HashedStreamReader to HashStreamFile 2022-05-17 13:25:38 +03:00
Saugat Pachhai (सौगात) 01e5f9eadd objects.hash: use fobj.read instead of read1 2022-05-17 13:25:38 +03:00
Saugat Pachhai (सौगात) 752e10a834 dvc.objects: move HashedStreamReader to objects, use it for calculating fobj_md5
Now HashedStreamReader will be used to calculate md5 in fobj_md5/hash_file.

Also:
* adds in `bytes_md5` that may be useful for testing.
* adds a hasher-registry with hashlib
* adds a `text=` kwarg to be able to specify to use dos2unix or not
  (useful for testing)
* makes `localfs` the default filesystem when `fs` arg is not passed
  (makes it easier to test in the REPL)
2022-05-17 13:25:38 +03:00
Saugat Pachhai (सौगात) 092eda183c objects.fs: use getpass for prompts
Note that this will change the behaviour of DVC to always show
prompt even in --quiet mode, which is what we need.
Previously it'd prompt without any message.
2022-05-17 16:06:27 +05:45
Saugat Pachhai (सौगात) d82e094b13 fs: move filesystems to dvc.objects.fs.implementations 2022-05-16 17:54:57 +03:00
Saugat Pachhai (सौगात) 570e3a5359 dvc.fs: move fs to dvc.objects.fs
Some of the APIs/FileSystems are reimported inside dvc.fs module.
2022-05-16 13:15:19 +03:00
Saugat Pachhai (सौगात) b8e770747f fs.utils: copy dvc.utils.fs to dvc.fs.utils 2022-05-16 11:51:48 +05:45
Saugat Pachhai (सौगात) c6ae91c907 dvc.fs: fix iscopy 2022-05-16 08:25:23 +05:45
Saugat Pachhai (सौगात) dc1d3e880a dvc.objects.cache: set type in a more compatible way
It turns out that diskcache.Disk saves passed arguments to the database
and uses that all the time. So this means that we are not forward
compatible as it breaks moving from newer version of DVC to an older
one. We don't promise this, but this breaks our benchmarks which
are probably not isolated enough.

Regarding the use of cache, it is a bit iffy to extend it this way.
We only need this type for error messages. We could consider removing
this, but since the error message is documented and it's not too hard
to extend this :), I decided to preserve the message.
2022-05-13 11:00:31 +05:45
Saugat Pachhai (सौगात) 3f5757a0a5 dvc.objects: move hashing functions to dvc.objects
This commit moves `HashedStreamReader`/`get_hash_file`/`file_md5`
into `dvc.objects.hash`.

The `get_hash_file` has been renamed to `hash_file`.
This also copies `relpath` and `is_exec` to the `dvc.fs.utils`.
2022-05-12 20:33:18 +03:00
skshetry b3fb0dfdad dvc.objects: extend diskcache to handle pickle errors (#7734)
dvc.objects: extend diskcache to handle pickle errors
2022-05-12 21:12:33 +05:45
Saugat Pachhai (सौगात) ee29888e18 dvc.objects: move get_mtime_and_size to dvc.objects.utils 2022-05-12 18:02:42 +03:00
Saugat Pachhai (सौगात) 11eaa87849 add typings to istextfile and system
Also moves umask to dvc.fs.system
2022-05-12 18:02:42 +03:00
Saugat Pachhai (सौगात) b4faa5616f system: change System class to a dvc.fs.system module 2022-05-12 18:02:42 +03:00
Saugat Pachhai (सौगात) 4d6df989f2 dvc.objects: change imports to relative 2022-05-12 18:02:42 +03:00
Saugat Pachhai (सौगात) e585c52187 istextfile: move to dvc.objects 2022-05-12 18:02:42 +03:00
Saugat Pachhai (सौगात) 4add88f627 objects: move System to dvc.fs 2022-05-12 18:02:42 +03:00
Saugat Pachhai (सौगात) aac2fc0ca0 dvc.fs: rename fs.utils to fs.generic
In the spirit of fsspec.generic, it is for cross-filesystem operations.
Trying to avoid `fs.utils` as much as possible, but we have some
functions that are really utilities coming, so I am making a place
for them. :)
2022-05-12 18:02:15 +03:00
Saugat Pachhai (सौगात) 14c9348f93 dvc.objects: move hash_info, state and meta into dvc.objects 2022-05-11 17:35:48 +03:00
Saugat Pachhai (सौगात) d92c6fed67 fs.callbacks: simplify, ensure None does not break them, lazy richcallbacks 2022-05-10 20:37:21 +05:45
Saugat Pachhai (सौगात) f10dbef0cf TqdmCallback: minor fixup, check for None explicitly
Tqdm supports __bool__, so we should really use `is not None` test
rather than boolean check. This is not used anywhere right now, but
I'd prefer being correct.
2022-05-10 14:22:13 +05:45
Saugat Pachhai (सौगात) 8fb2f65d4b TqdmCallback: make it lazy 2022-05-10 13:41:54 +05:45
Saugat Pachhai (सौगात) 562e61235b objects: do not inherit from DvcException 2022-05-06 13:24:41 +03:00
Saugat Pachhai (सौगात) f89f4ac152 fs.put: introduce non-recursive put 2022-05-05 21:22:29 +03:00
Saugat Pachhai (सौगात) 54dd3ae90c fs.get: use async implementation when supported by the filesystem 2022-05-05 14:15:21 +03:00
Saugat Pachhai (सौगात) c64db917f5 fs: add more fsspec methods 2022-05-05 08:16:34 +05:45
Saugat Pachhai (सौगात) 5067e1f5bc fs.utils.transfer: remove tqdm progress bars 2022-05-03 15:15:48 +05:45
Saugat Pachhai (सौगात) 8a0c5680e0 fs: remove download 2022-05-03 14:42:19 +05:45
Saugat Pachhai (सौगात) 61699d1d66 fs: remove upload function 2022-05-03 11:22:21 +05:45
Saugat Pachhai (सौगात) d0e05c4b66 deps: bump s3fs to 2022.02.0
The callbacks on _get_file/_put_file was only supported on >2022.02.0.
Fixes #7669.
2022-05-02 12:57:00 +03:00
Saugat Pachhai (सौगात) dd187df667 fs.utils: add upload that can be conditionally atomic
The PR also makes odb.add operations atomic, but the checkout is still
not atomic.
2022-04-29 23:02:15 +03:00
Saugat Pachhai (सौगात) b71ea349d2 repofs: only use dvcfs when --dvc-only is specified 2022-04-29 12:03:46 +03:00
Saugat Pachhai (सौगात) 127a9c74b2 fs.put_file: fix function signature for size 2022-04-28 15:54:40 +05:45
Saugat Pachhai (सौगात) e30d2fdda5 fs.put_file: don't require size to be passed 2022-04-28 15:31:28 +05:45
Saugat Pachhai (सौगात) ae4f56c5ad fs.put_file: don't require size to be passed 2022-04-28 15:31:28 +05:45
Saugat Pachhai (सौगात) 36d53bd403 dvc.stage: log time duration on stage collection walk in verbose mode 2022-04-27 18:04:14 +03:00
Saugat Pachhai (सौगात) 46fac33ba5 fs: remove unused CHUNK_SIZE var
There is no support for chunk_size kwarg in fs.open.
Also, `upload_fobj` is now able to figure out proper
chunk size from fileobj, so I don't think we need this on _upload_file.
2022-04-27 19:06:46 +05:45
Saugat Pachhai (सौगात) 4f1fdf0b0c fs.ossfs: remove unused var COPY_POLL_SECONDS 2022-04-27 18:06:24 +05:45
Saugat Pachhai (सौगात) 0d48598e4b fs.ssh: remove unused vars 2022-04-27 17:56:08 +05:45
Saugat Pachhai (सौगात) 5d64f6504f fs.s3: remove custom put_file/get_file 2022-04-27 17:53:17 +05:45
Saugat Pachhai (सौगात) 3d54039614 scm: fix progress bar, show progress and repo being cloned
Before, as we were not passing `total`, the Tqdm progress bar would not
show the bar or not show any progress on the bar. As we get that value lazily,
we should force it to always show the bar.
Also updated the progress bar to say which repo is being cloned.
2022-04-27 16:42:28 +05:45
Saugat Pachhai (सौगात) cda855b97a fs: add cat/cat_file/cat_ranges/pipe/pipe_file/touch methods 2022-04-27 15:57:17 +05:45
Saugat Pachhai (सौगात) f84f9cf184 fs: do not pass size to underlying fs.put_file 2022-04-26 18:37:17 +05:45
Saugat Pachhai (सौगात) b53ebc1a5e build: try fixing building package 2022-04-26 17:28:36 +05:45
Saugat Pachhai (सौगात) 31e8eed402 fsspec.callbacks: add rich based callbacks
We have some issues, so we cannot enable them just yet, but will
be good to merge this so that we can play with it.
2022-04-26 12:28:32 +05:45
Saugat Pachhai (सौगात) 112ea1d448 dvc.objects: add callbacks for listing and estimating hashes
This PR gets rid of Tqdm progress bars inside `dvc.objects`.
Those are replaced with multi-phase callback in `hashes_exist`, and
simple callable that takes `completed` value in
`odb._estimate_remote_size()`.

The `odb.list_hashes_exists()` and `odb.all()` now return iterables,
hence the caller has the responsibility of handling progress.

This is now handled in `dvc.data` by using a custom `Tqdm` progressbar.
This is ugly and is temporary, but my motivation is to remove tqdm from dvc.objects
first. We can gradually get rid of these from `dvc.data` too, but
that requires more knowledge about `dvc.data` and involves more
design work. All in time, I guess. :)
2022-04-26 07:38:24 +05:45
Saugat Pachhai (सौगात) f39e35445a fs.upload/download: simplify, remove unused kwargs, callbacks
1. This PR simplifies `fs.upload`/`fs.download`/`fs.download_file`.
2. Removes unused kwargs.
3. `download` uses `dvc.utils.threadpool.ThreadPoolExecutor` which
   supports canceling futures.
4. `download` for directories supports nested/branched callbacks
   and progress bars.
2022-04-26 06:57:10 +05:45
Saugat Pachhai (सौगात) 83795ff3df fs.put_file: add support for uploading fileobjects
Also changed the callbacks to inherit from our own so that we can
add few more utilities to it.
2022-04-25 21:23:05 +05:45
Saugat Pachhai (सौगात) 8ead29805f fs: rename getsize to size 2022-04-25 18:52:46 +05:45
Saugat Pachhai fecc81e951 Revert "dvc.objects: add callbacks for listing and estimating hashes"
This reverts commit 7599c6e20d.
2022-04-25 18:37:05 +05:45