materials-commons-cli 2.3.0b10__tar.gz → 2.3.0b12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/PKG-INFO +24 -4
- materials_commons_cli-2.3.0b12/materials_commons/cli/__init__.py +1 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/parser.py +3 -8
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/reconcile3.py +2 -1
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/downloader/file_downloader.py +2 -1
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/uploader/file_uploader.py +20 -2
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/websocket_server.py +1 -1
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/up.py +6 -1
- materials_commons_cli-2.3.0b12/materials_commons/cli/terminal_progress.py +107 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons_cli.egg-info/PKG-INFO +25 -5
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons_cli.egg-info/SOURCES.txt +3 -2
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons_cli.egg-info/requires.txt +0 -2
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/setup.py +0 -2
- materials_commons_cli-2.3.0b12/tests/test_file_uploader.py +986 -0
- materials_commons_cli-2.3.0b12/tests/test_reconcile3.py +125 -0
- materials_commons_cli-2.3.0b10/materials_commons/cli/__init__.py +0 -1
- materials_commons_cli-2.3.0b10/materials_commons/cli/subcommands/mcp.py +0 -86
- materials_commons_cli-2.3.0b10/materials_commons/cli/terminal_progress.py +0 -45
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/LICENSE +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/README.md +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/LICENSE.txt +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/async_reconciler.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/config.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/downloader.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/filedb.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/local_project.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/models.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/__init__.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/cloned_project.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/exceptions.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/file_functions.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/functions.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/globus.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/list_objects.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/print_formatter.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/sqltable.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/tmp_functions.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/tree_functions.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/treedb.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/old/user_config.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/reconcile2.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/requests.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/run.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/__init__.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/command_handlers/__init__.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/command_handlers/admin_handler_lookup.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/command_handlers/download_handler_lookup.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/command_handlers/list_handler_lookup.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/command_handlers/multi_handler_lookup.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/command_handlers/protocol.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/command_handlers/search_find_handler_lookup.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/command_handlers/upload_handler_lookup.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/db/__init__.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/db/db_manager.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/downloader/__init__.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/downloader/file_download_manager.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/indexer/__init__.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/indexer/file_index_manager.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/local_rest_server.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/ocommand_handlers.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/project_filedbs.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/projects.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/service_container.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/service_runtime.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/uploader/__init__.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/uploader/client_api.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/server/uploader/file_upload_manager.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/__init__.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/clone.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/config.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/dataset.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/down.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/down2.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/expt.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/fetch.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/globus.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/init.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/ls.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/ls2.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/mkdir.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/mv.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/proj.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/remote.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/rm.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/runners/__init__.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/runners/download_globus_runner.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/runners/download_v1_runner.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/scan.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/server.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/subcommands/versions.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/walk.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons_cli.egg-info/dependency_links.txt +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons_cli.egg-info/entry_points.txt +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons_cli.egg-info/not-zip-safe +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons_cli.egg-info/top_level.txt +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/setup.cfg +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_api.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_functions.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_mc_dataset.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_mc_down.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_mc_mkdir.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_mc_mv.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_mc_proj.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_mc_rm.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_mc_up.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_treecompare_no_cache.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_treecompare_with_cache.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_treedb.py +0 -0
- {materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/test/test_user_config.py +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: materials_commons_cli
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.0b12
|
|
4
4
|
Summary: Materials Commons CLI
|
|
5
5
|
Home-page: https://materials-commons.github.io/materials-commons-cli/html/index.html
|
|
6
6
|
Author: Materials Commons development team
|
|
7
7
|
Author-email: materials-commons-help@umich.edu
|
|
8
8
|
License: MIT
|
|
9
9
|
Keywords: materials science mc materials-commons prisms
|
|
10
|
-
Platform: UNKNOWN
|
|
11
10
|
Classifier: Development Status :: 4 - Beta
|
|
12
11
|
Classifier: Intended Audience :: Developers
|
|
13
12
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -16,10 +15,31 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
16
15
|
Classifier: Programming Language :: Python :: 3
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.8
|
|
18
17
|
License-File: LICENSE
|
|
18
|
+
Requires-Dist: websockets~=16.0
|
|
19
|
+
Requires-Dist: aiofiles~=25.1
|
|
20
|
+
Requires-Dist: globus-cli~=3.9
|
|
21
|
+
Requires-Dist: globus-sdk~=3.13
|
|
22
|
+
Requires-Dist: igittigitt==2.1
|
|
23
|
+
Requires-Dist: materials-commons-api>=2.0.1
|
|
24
|
+
Requires-Dist: python-dateutil~=2.8
|
|
25
|
+
Requires-Dist: pyyaml~=6.0
|
|
26
|
+
Requires-Dist: requests~=2.28
|
|
27
|
+
Requires-Dist: sortedcontainers~=2.4
|
|
28
|
+
Requires-Dist: tabulate~=0.9
|
|
29
|
+
Requires-Dist: aiosqlite~=0.22
|
|
30
|
+
Dynamic: author
|
|
31
|
+
Dynamic: author-email
|
|
32
|
+
Dynamic: classifier
|
|
33
|
+
Dynamic: description
|
|
34
|
+
Dynamic: home-page
|
|
35
|
+
Dynamic: keywords
|
|
36
|
+
Dynamic: license
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
Dynamic: requires-dist
|
|
39
|
+
Dynamic: summary
|
|
19
40
|
|
|
20
41
|
This package contains the materials_commons.cli module. This module is an interface
|
|
21
42
|
to the Materials Commons project. We assume you have used (or are otherwise familiar with) the Materials
|
|
22
43
|
Commons web site, https://materialscommons.org/, or a similar site based on the
|
|
23
44
|
Materials Commons code (https://github.com/materials-commons/materialscommons), and intend to use these
|
|
24
45
|
tools in that context.
|
|
25
|
-
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.3.0b12'
|
{materials_commons_cli-2.3.0b10 → materials_commons_cli-2.3.0b12}/materials_commons/cli/parser.py
RENAMED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import json
|
|
3
3
|
import logging
|
|
4
|
+
import materials_commons.api as mcapi
|
|
4
5
|
import os
|
|
5
6
|
import sys
|
|
6
7
|
from datetime import datetime, timedelta
|
|
7
8
|
from importlib.metadata import PackageNotFoundError, version as pkg_version
|
|
8
9
|
from io import StringIO
|
|
9
10
|
|
|
10
|
-
import materials_commons.api as mcapi
|
|
11
|
-
import requests
|
|
12
|
-
|
|
13
11
|
import materials_commons.cli.old.functions as clifuncs
|
|
12
|
+
import requests
|
|
14
13
|
from materials_commons.cli.old.exceptions import MCCLIException, MissingRemoteException, \
|
|
15
14
|
MultipleRemoteException, NoDefaultRemoteException
|
|
16
15
|
from materials_commons.cli.old.user_config import Config
|
|
@@ -18,15 +17,12 @@ from materials_commons.cli.subcommands.clone import clone_subcommand
|
|
|
18
17
|
from materials_commons.cli.subcommands.config import config_subcommand
|
|
19
18
|
from materials_commons.cli.subcommands.dataset import DatasetSubcommand
|
|
20
19
|
from materials_commons.cli.subcommands.down import down_subcommand
|
|
21
|
-
from materials_commons.cli.subcommands.down2 import down2_subcommand
|
|
22
20
|
from materials_commons.cli.subcommands.expt import ExptSubcommand
|
|
23
21
|
from materials_commons.cli.subcommands.fetch import fetch_subcommand
|
|
24
22
|
# from materials_commons.cli.subcommands.samp import SampSubcommand
|
|
25
23
|
from materials_commons.cli.subcommands.globus import globus_subcommand
|
|
26
24
|
from materials_commons.cli.subcommands.init import init_subcommand
|
|
27
25
|
from materials_commons.cli.subcommands.ls import ls_subcommand
|
|
28
|
-
from materials_commons.cli.subcommands.ls2 import ls2_subcommand
|
|
29
|
-
from materials_commons.cli.subcommands.mcp import mcp_subcommand
|
|
30
26
|
from materials_commons.cli.subcommands.mkdir import mkdir_subcommand
|
|
31
27
|
from materials_commons.cli.subcommands.mv import mv_subcommand
|
|
32
28
|
# from materials_commons.cli.subcommands.proc import ProcSubcommand
|
|
@@ -61,7 +57,6 @@ standard_usage = [
|
|
|
61
57
|
# {'name': 'down2', 'desc': 'Donwload files (experimental)', 'subcommand': down2_subcommand},
|
|
62
58
|
{'name': 'config', 'desc': 'Configure `mc`', 'subcommand': config_subcommand},
|
|
63
59
|
{'name': 'server', 'desc': 'Run MC Server', 'subcommand': server_subcommand},
|
|
64
|
-
{'name': 'mcp', 'desc': 'Run MCP Server', 'subcommand': mcp_subcommand},
|
|
65
60
|
]
|
|
66
61
|
standard_interfaces = {d['name']: d for d in standard_usage}
|
|
67
62
|
|
|
@@ -169,7 +164,7 @@ def main(argv=None, working_dir=None):
|
|
|
169
164
|
|
|
170
165
|
if args.command in standard_interfaces:
|
|
171
166
|
result = standard_interfaces[args.command]['subcommand'](argv[2:], working_dir)
|
|
172
|
-
check_package_version()
|
|
167
|
+
# check_package_version()
|
|
173
168
|
return result
|
|
174
169
|
|
|
175
170
|
else:
|
|
@@ -472,5 +472,6 @@ class SingleFileReconciler:
|
|
|
472
472
|
|
|
473
473
|
result = await asyncio.to_thread(checksum, path.as_posix(), 1024 * 1024, progress_callback)
|
|
474
474
|
|
|
475
|
-
await TerminalProgress.render(progress_id, make_line(total_bytes, "checksum complete")
|
|
475
|
+
await TerminalProgress.render(progress_id, make_line(total_bytes, "checksum complete"),
|
|
476
|
+
done=True)
|
|
476
477
|
return result
|
|
@@ -74,7 +74,7 @@ class FileUploader:
|
|
|
74
74
|
"""
|
|
75
75
|
try:
|
|
76
76
|
if self.file_size == 0:
|
|
77
|
-
|
|
77
|
+
await TerminalProgress.write_line(f"Skipping {self.file_path.as_posix()} (empty file)...")
|
|
78
78
|
return True
|
|
79
79
|
|
|
80
80
|
await self._render_progress(status="starting")
|
|
@@ -209,6 +209,21 @@ class FileUploader:
|
|
|
209
209
|
logger.error(f"Transfer rejected: {reason}")
|
|
210
210
|
return False
|
|
211
211
|
|
|
212
|
+
elif msg["command"] == "TRANSFER_ALREADY_UPLOADED":
|
|
213
|
+
payload = msg["payload"]
|
|
214
|
+
updated_record = replace(self.upload_request.updated_record,
|
|
215
|
+
local_last_seen_ts=int(time.time()),
|
|
216
|
+
remote_checksum=payload.get("file_checksum", ""),
|
|
217
|
+
remote_size=payload.get("file_size", 0),
|
|
218
|
+
remote_file_id=payload.get("file_id", 0),
|
|
219
|
+
remote_ctime_ns=payload.get("file_created_at_ns", 0))
|
|
220
|
+
db_write_request = DBWriteRequest(project=self.upload_request.project,
|
|
221
|
+
data=updated_record,
|
|
222
|
+
command="single")
|
|
223
|
+
await self.db_write_queue.put(db_write_request)
|
|
224
|
+
self._already_uploaded = True
|
|
225
|
+
return False
|
|
226
|
+
|
|
212
227
|
logger.error(f"Unexpected response: {msg['command']}")
|
|
213
228
|
return False
|
|
214
229
|
|
|
@@ -522,7 +537,10 @@ class FileUploader:
|
|
|
522
537
|
f"{status}"
|
|
523
538
|
)
|
|
524
539
|
|
|
525
|
-
|
|
540
|
+
# Anything other than an in-flight status is terminal for this file, so
|
|
541
|
+
# the row is retired rather than held open for the rest of the run.
|
|
542
|
+
await TerminalProgress.render(self.transfer_id, line,
|
|
543
|
+
done=status not in ("uploading", "starting"))
|
|
526
544
|
|
|
527
545
|
def _calculate_md5(self, chunk_size=8192) -> str:
|
|
528
546
|
"""Calculate md5 hash of file"""
|
|
@@ -241,7 +241,7 @@ class WebSocketCommandListener:
|
|
|
241
241
|
|
|
242
242
|
headers["MC-Client-ID"] = self.client_uuid
|
|
243
243
|
headers["MC-Client-Hostname"] = socket.gethostname()
|
|
244
|
-
headers["MC-Connection-Type"] = "
|
|
244
|
+
headers["MC-Connection-Type"] = "pycli"
|
|
245
245
|
|
|
246
246
|
try:
|
|
247
247
|
projects = server.list_local_projects()
|
|
@@ -192,6 +192,9 @@ async def ws_upload(args, working_dir):
|
|
|
192
192
|
ignore_parser = igittigitt.IgnoreParser()
|
|
193
193
|
ignore_parser.parse_rule_files(base_dir=proj.local_path, filename=".mcignore", add_default_patterns=False)
|
|
194
194
|
|
|
195
|
+
def ignore(path, _ignore):
|
|
196
|
+
return ignore_parser.match(path)
|
|
197
|
+
|
|
195
198
|
# Start services
|
|
196
199
|
container = ServiceContainer.create(ws_url=args.ws_url)
|
|
197
200
|
service_runtime = ServiceRuntime(container)
|
|
@@ -204,7 +207,7 @@ async def ws_upload(args, working_dir):
|
|
|
204
207
|
p = Path(path)
|
|
205
208
|
if p.is_dir():
|
|
206
209
|
async for current_path, path_entries in async_reconciler.walk(path=path, listdir_fn=local_listdir,
|
|
207
|
-
recursive=args.recursive, ignore_fn=
|
|
210
|
+
recursive=args.recursive, ignore_fn=ignore):
|
|
208
211
|
for entry_name in sorted(path_entries):
|
|
209
212
|
file_state = path_entries[entry_name]
|
|
210
213
|
if file_state.exception:
|
|
@@ -218,6 +221,8 @@ async def ws_upload(args, working_dir):
|
|
|
218
221
|
transfer_id = await container.file_upload_manager.upload_file(upload_request)
|
|
219
222
|
transfer_ids.append(transfer_id)
|
|
220
223
|
elif p.is_file():
|
|
224
|
+
if ignore(p, True):
|
|
225
|
+
continue
|
|
221
226
|
file_state = await async_reconciler.reconcile_file(p)
|
|
222
227
|
if file_state.exception:
|
|
223
228
|
logger.error(f"Error encountered while processing {p}: {file_state.exception}")
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import shutil
|
|
3
|
+
import sys
|
|
4
|
+
from collections import OrderedDict
|
|
5
|
+
from typing import Iterable, Optional
|
|
6
|
+
|
|
7
|
+
def format_bytes(value: float) -> str:
|
|
8
|
+
"""Format bytes as a human-readable value."""
|
|
9
|
+
units = ("B", "KB", "MB", "GB", "TB")
|
|
10
|
+
size = float(value)
|
|
11
|
+
|
|
12
|
+
for unit in units:
|
|
13
|
+
if size < 1024.0 or unit == units[-1]:
|
|
14
|
+
return f"{size:.1f} {unit}"
|
|
15
|
+
size /= 1024.0
|
|
16
|
+
|
|
17
|
+
return f"{size:.1f} TB"
|
|
18
|
+
|
|
19
|
+
class TerminalProgress:
|
|
20
|
+
"""Renders in-progress transfers as a block of lines pinned to the bottom of
|
|
21
|
+
the terminal.
|
|
22
|
+
|
|
23
|
+
The block is repainted in its entirety on every update, using only cursor
|
|
24
|
+
movements relative to the line just below the block. Absolute row addressing
|
|
25
|
+
is deliberately avoided: it breaks as soon as the terminal scrolls, the
|
|
26
|
+
window is resized, or more transfers are tracked than the screen has rows.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
_lock: Optional[asyncio.Lock] = None
|
|
30
|
+
_active: "OrderedDict[str, str]" = OrderedDict()
|
|
31
|
+
|
|
32
|
+
# Number of terminal rows the live block currently occupies. The cursor is
|
|
33
|
+
# always left at column 0 of the row immediately below the block.
|
|
34
|
+
_painted = 0
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def _get_lock(cls) -> asyncio.Lock:
|
|
38
|
+
# Created lazily so the lock binds to the running loop, not to whatever
|
|
39
|
+
# loop happened to exist at import time.
|
|
40
|
+
if cls._lock is None:
|
|
41
|
+
cls._lock = asyncio.Lock()
|
|
42
|
+
return cls._lock
|
|
43
|
+
|
|
44
|
+
@staticmethod
|
|
45
|
+
def _fit(line: str, width: int) -> str:
|
|
46
|
+
# Stay one column short of the edge; writing into the last column
|
|
47
|
+
# triggers deferred wrapping on most terminals, which would make the
|
|
48
|
+
# line occupy two rows and throw off the repaint arithmetic.
|
|
49
|
+
limit = max(width - 1, 8)
|
|
50
|
+
if len(line) <= limit:
|
|
51
|
+
return line
|
|
52
|
+
return line[:limit - 3] + "..."
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def _repaint(cls, permanent_lines: Iterable[str] = ()) -> None:
|
|
56
|
+
size = shutil.get_terminal_size(fallback=(80, 24))
|
|
57
|
+
max_rows = max(size.lines - 1, 1)
|
|
58
|
+
|
|
59
|
+
out = []
|
|
60
|
+
if cls._painted:
|
|
61
|
+
out.append(f"\033[{cls._painted}A")
|
|
62
|
+
out.append("\r")
|
|
63
|
+
|
|
64
|
+
# Lines that are done scroll away into the terminal's scrollback.
|
|
65
|
+
for text in permanent_lines:
|
|
66
|
+
out.append("\033[2K" + cls._fit(text, size.columns) + "\n")
|
|
67
|
+
|
|
68
|
+
# Only as many rows as fit on screen; anything above the top would be
|
|
69
|
+
# clamped by the terminal and repaint over itself.
|
|
70
|
+
visible = list(cls._active.values())[-max_rows:]
|
|
71
|
+
for text in visible:
|
|
72
|
+
out.append("\033[2K" + cls._fit(text, size.columns) + "\n")
|
|
73
|
+
|
|
74
|
+
# Clear whatever the previous, taller block left behind.
|
|
75
|
+
out.append("\033[J")
|
|
76
|
+
|
|
77
|
+
cls._painted = len(visible)
|
|
78
|
+
sys.stdout.write("".join(out))
|
|
79
|
+
sys.stdout.flush()
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
async def render(cls, progress_id: str, line: str, done: bool = False):
|
|
83
|
+
"""Update the row for ``progress_id``.
|
|
84
|
+
|
|
85
|
+
When ``done`` is set the row is retired: it is written out as permanent
|
|
86
|
+
output above the live block and no longer takes up a row.
|
|
87
|
+
"""
|
|
88
|
+
if not sys.stdout.isatty():
|
|
89
|
+
return
|
|
90
|
+
|
|
91
|
+
async with cls._get_lock():
|
|
92
|
+
if done:
|
|
93
|
+
cls._active.pop(progress_id, None)
|
|
94
|
+
cls._repaint([line])
|
|
95
|
+
else:
|
|
96
|
+
cls._active[progress_id] = line
|
|
97
|
+
cls._repaint()
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
async def write_line(cls, line: str):
|
|
101
|
+
"""Emit a normal output line without corrupting the progress block."""
|
|
102
|
+
if not sys.stdout.isatty():
|
|
103
|
+
print(line)
|
|
104
|
+
return
|
|
105
|
+
|
|
106
|
+
async with cls._get_lock():
|
|
107
|
+
cls._repaint([line])
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name:
|
|
3
|
-
Version: 2.3.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: materials_commons_cli
|
|
3
|
+
Version: 2.3.0b12
|
|
4
4
|
Summary: Materials Commons CLI
|
|
5
5
|
Home-page: https://materials-commons.github.io/materials-commons-cli/html/index.html
|
|
6
6
|
Author: Materials Commons development team
|
|
7
7
|
Author-email: materials-commons-help@umich.edu
|
|
8
8
|
License: MIT
|
|
9
9
|
Keywords: materials science mc materials-commons prisms
|
|
10
|
-
Platform: UNKNOWN
|
|
11
10
|
Classifier: Development Status :: 4 - Beta
|
|
12
11
|
Classifier: Intended Audience :: Developers
|
|
13
12
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -16,10 +15,31 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
16
15
|
Classifier: Programming Language :: Python :: 3
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.8
|
|
18
17
|
License-File: LICENSE
|
|
18
|
+
Requires-Dist: websockets~=16.0
|
|
19
|
+
Requires-Dist: aiofiles~=25.1
|
|
20
|
+
Requires-Dist: globus-cli~=3.9
|
|
21
|
+
Requires-Dist: globus-sdk~=3.13
|
|
22
|
+
Requires-Dist: igittigitt==2.1
|
|
23
|
+
Requires-Dist: materials-commons-api>=2.0.1
|
|
24
|
+
Requires-Dist: python-dateutil~=2.8
|
|
25
|
+
Requires-Dist: pyyaml~=6.0
|
|
26
|
+
Requires-Dist: requests~=2.28
|
|
27
|
+
Requires-Dist: sortedcontainers~=2.4
|
|
28
|
+
Requires-Dist: tabulate~=0.9
|
|
29
|
+
Requires-Dist: aiosqlite~=0.22
|
|
30
|
+
Dynamic: author
|
|
31
|
+
Dynamic: author-email
|
|
32
|
+
Dynamic: classifier
|
|
33
|
+
Dynamic: description
|
|
34
|
+
Dynamic: home-page
|
|
35
|
+
Dynamic: keywords
|
|
36
|
+
Dynamic: license
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
Dynamic: requires-dist
|
|
39
|
+
Dynamic: summary
|
|
19
40
|
|
|
20
41
|
This package contains the materials_commons.cli module. This module is an interface
|
|
21
42
|
to the Materials Commons project. We assume you have used (or are otherwise familiar with) the Materials
|
|
22
43
|
Commons web site, https://materialscommons.org/, or a similar site based on the
|
|
23
44
|
Materials Commons code (https://github.com/materials-commons/materialscommons), and intend to use these
|
|
24
45
|
tools in that context.
|
|
25
|
-
|
|
@@ -69,7 +69,6 @@ materials_commons/cli/subcommands/globus.py
|
|
|
69
69
|
materials_commons/cli/subcommands/init.py
|
|
70
70
|
materials_commons/cli/subcommands/ls.py
|
|
71
71
|
materials_commons/cli/subcommands/ls2.py
|
|
72
|
-
materials_commons/cli/subcommands/mcp.py
|
|
73
72
|
materials_commons/cli/subcommands/mkdir.py
|
|
74
73
|
materials_commons/cli/subcommands/mv.py
|
|
75
74
|
materials_commons/cli/subcommands/proj.py
|
|
@@ -101,4 +100,6 @@ test/test_mc_up.py
|
|
|
101
100
|
test/test_treecompare_no_cache.py
|
|
102
101
|
test/test_treecompare_with_cache.py
|
|
103
102
|
test/test_treedb.py
|
|
104
|
-
test/test_user_config.py
|
|
103
|
+
test/test_user_config.py
|
|
104
|
+
tests/test_file_uploader.py
|
|
105
|
+
tests/test_reconcile3.py
|