bfabric-scripts 1.18.0__tar.gz → 1.19.0__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.
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/PKG-INFO +2 -2
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/docs/changelog.md +10 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/pyproject.toml +2 -2
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/_common.py +16 -1
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/oauth_login.py +22 -10
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/workunit/upload.py +50 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/.gitignore +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/README.md +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/example/test_webapp_flow.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/__init__.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_executable_submitter_functionalTest.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_executable_submitter_gridengine.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_executable_submitter_slurm.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_executable_wrappercreator.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_feeder_mascot.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_flask.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_list_not_existing_storage_directories.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_list_workunit_parameters.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_logthis.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_read.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_read_samples_from_dataset.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_read_samples_of_workunit.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_csv2dataset.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_dataset2csv.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_fasta.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_importresource_sample.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_link_to_workunit.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_resource_description.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_workflowstep.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_workunit_attribute.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_setExternalJobStatus_done.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_setResourceStatus_available.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_setWorkunitStatus.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_slurm_queue_status.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_upload_resource.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_upload_submitter_executable.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_wrapper_creator_yaml.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/__init__.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/__main__.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/__init__.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/create.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/delete.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/inspect.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/namespaces.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/output_format.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/parser.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/query_repr.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/read.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/update.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/cli_api.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/cli_auth.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/cli_dataset.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/cli_executable.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/cli_external_job.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/cli_feeder.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/cli_workunit.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/dataset/__init__.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/dataset/download.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/dataset/show.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/dataset/update.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/dataset/upload.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/executable/__init__.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/executable/dump.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/executable/show.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/executable/upload.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/external_job/__init__.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/external_job/upload_submitter_executable.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/external_job/upload_wrapper_creator_executable.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/interactive.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/__init__.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/_constants.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/_urls.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/client_manage.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/manage.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/pat.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/register.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/register_webapp.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/service_account.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/workunit/__init__.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/workunit/diff.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/workunit/export_definition.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/workunit/not_available.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/feeder/__init__.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/feeder/file_attributes.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/feeder/path_convention_compms.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/feeder/report.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/fgcz_maxquant_scaffold-wrapper.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/fgcz_maxquant_wrapper.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/fgcz_sge_maxquant_linux.bash +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/optional_features.py +0 -0
- {bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/py.typed +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bfabric_scripts
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.19.0
|
|
4
4
|
Summary: Python command line scripts for the B-Fabric API
|
|
5
5
|
Author: Aleksejs Fomins, Marco Schmidt, Maria d'Errico, Witold Eryk Wolski
|
|
6
6
|
Author-email: Christian Panse <cp@fgcz.ethz.ch>, Claudio Cannizzaro <claudio.cannizzaro@fgcz.uzh.ch>, Leonardo Schwarz <leonardo.schwarz@fgcz.ethz.ch>
|
|
7
7
|
Requires-Python: >=3.11
|
|
8
|
-
Requires-Dist: bfabric[transfer]<2,>=1.
|
|
8
|
+
Requires-Dist: bfabric[transfer]<2,>=1.24.0
|
|
9
9
|
Requires-Dist: cyclopts<5.0,>=4.0
|
|
10
10
|
Requires-Dist: flask<4.0,>=3.0.3
|
|
11
11
|
Requires-Dist: lxml<7.0,>=5.0
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
## \[Unreleased\]
|
|
2
2
|
|
|
3
|
+
## \[1.19.0\] - 2026-10-05
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `bfabric-cli login` and `auth device-code` no longer fail on an environment recorded with an `http://` base URL; they use `https://` and save the corrected URL.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- `bfabric-cli login` switches to the device-code flow over SSH, without a display, or with only a text browser, unless `--no-browser` is given. `bfabric-cli workunit upload` shows a progress bar while hashing, including an overall total and ETA, hashes 4 files at once (`--hash-workers`), and reuses checksums of unchanged files from earlier runs (`--no-hash-cache` to disable). `--chunk-size` (MiB) sets the upload chunk size; it defaults to 32 instead of 4, which is faster on fast links.
|
|
12
|
+
|
|
3
13
|
## \[1.18.0\] - 2026-09-16
|
|
4
14
|
|
|
5
15
|
### Added
|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
name = "bfabric_scripts"
|
|
7
7
|
description = "Python command line scripts for the B-Fabric API"
|
|
8
8
|
readme = "README.md"
|
|
9
|
-
version = "1.
|
|
9
|
+
version = "1.19.0"
|
|
10
10
|
authors = [
|
|
11
11
|
{ name = "Christian Panse", email = "cp@fgcz.ethz.ch" },
|
|
12
12
|
{ name = "Claudio Cannizzaro", email = "claudio.cannizzaro@fgcz.uzh.ch" },
|
|
@@ -18,7 +18,7 @@ authors = [
|
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
dependencies = [
|
|
21
|
-
"bfabric[transfer]>=1.
|
|
21
|
+
"bfabric[transfer]>=1.24.0,<2",
|
|
22
22
|
"cyclopts>=4.0,<5.0",
|
|
23
23
|
"Flask>=3.0.3,<4.0",
|
|
24
24
|
"questionary>=2.0,<3",
|
|
@@ -18,6 +18,7 @@ from bfabric.config.config_writer import write_environment_to_config
|
|
|
18
18
|
from bfabric_scripts.cli.interactive import confirm, is_interactive, select_choice, select_or_input, text_input
|
|
19
19
|
from bfabric_scripts.cli.login._constants import SCOPE_PRESETS, SCOPE_PRESETS_BY_NAME
|
|
20
20
|
from bfabric.config import BaseUrl
|
|
21
|
+
from bfabric.oauth import https_base_url
|
|
21
22
|
from bfabric_scripts.cli.login._urls import KNOWN_INSTANCES, normalize_base_url
|
|
22
23
|
|
|
23
24
|
if TYPE_CHECKING:
|
|
@@ -69,7 +70,21 @@ def _pick_or_type(message: str, labels: dict[str, str], prompt: str) -> str | No
|
|
|
69
70
|
|
|
70
71
|
|
|
71
72
|
def resolve_base_url(base_url: str | None, env: EnvironmentConfig | None) -> BaseUrl | None:
|
|
72
|
-
"""Resolve the instance URL: explicit, else the environment's recorded one, else a picker.
|
|
73
|
+
"""Resolve the instance URL: explicit, else the environment's recorded one, else a picker.
|
|
74
|
+
|
|
75
|
+
A plain ``http`` URL is upgraded to ``https`` (loopback excepted), so a login never sends its OAuth
|
|
76
|
+
requests unencrypted and the environment is saved with the corrected URL.
|
|
77
|
+
"""
|
|
78
|
+
resolved = _resolve_raw_base_url(base_url, env)
|
|
79
|
+
if resolved is None:
|
|
80
|
+
return None
|
|
81
|
+
secure = BaseUrl(https_base_url(resolved))
|
|
82
|
+
if secure != resolved:
|
|
83
|
+
print(f"Using {secure} instead of {resolved}: OAuth requires https.", file=sys.stderr)
|
|
84
|
+
return secure
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _resolve_raw_base_url(base_url: str | None, env: EnvironmentConfig | None) -> BaseUrl | None:
|
|
73
88
|
if base_url is not None:
|
|
74
89
|
return normalize_base_url(base_url)
|
|
75
90
|
if env is not None:
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/oauth_login.py
RENAMED
|
@@ -12,7 +12,7 @@ from typing import Annotated
|
|
|
12
12
|
|
|
13
13
|
import cyclopts
|
|
14
14
|
|
|
15
|
-
from bfabric.oauth import OAuthCredentialProvider, device_code_login, pkce_login
|
|
15
|
+
from bfabric.oauth import OAuthCredentialProvider, device_code_login, graphical_browser_available, pkce_login
|
|
16
16
|
from bfabric.config import DEFAULT_CONFIG_FILE
|
|
17
17
|
from bfabric.config.config_writer import write_environment_to_config
|
|
18
18
|
from bfabric_scripts.cli.interactive import confirm, is_interactive
|
|
@@ -36,6 +36,7 @@ _CONFIG_ENV_HELP = "Environment name (defaults to BFABRICPY_CONFIG_ENV or the co
|
|
|
36
36
|
_SET_DEFAULT_HELP = "Set this environment as the default in the config file (prompted for a new environment)."
|
|
37
37
|
_BASE_URL_HELP = "B-Fabric instance URL. Omit to reuse the environment's recorded URL."
|
|
38
38
|
_NO_BROWSER_HELP = "Print the authorization URL instead of opening a browser."
|
|
39
|
+
_DEVICE_CODE_TIMEOUT = 600.0
|
|
39
40
|
_CLIENT_ID_HELP = "OAuth client ID. Omit to reuse the environment's recorded ID, or the default 'CLI'."
|
|
40
41
|
|
|
41
42
|
|
|
@@ -139,6 +140,15 @@ def _persist(token: dict[str, object], params: _LoginParams, config_file: Path)
|
|
|
139
140
|
print(f"Config saved to environment '{params.config_env}' in {config_file}")
|
|
140
141
|
|
|
141
142
|
|
|
143
|
+
def _login_with_device_code(params: _LoginParams, config_file: Path, timeout: float) -> None:
|
|
144
|
+
try:
|
|
145
|
+
token = device_code_login(params.base_url, client_id=params.client_id, scope=params.scope, timeout=timeout)
|
|
146
|
+
except RuntimeError as e:
|
|
147
|
+
print(f"Error: {e}", file=sys.stderr)
|
|
148
|
+
raise SystemExit(1) from None
|
|
149
|
+
_persist(token, params, config_file)
|
|
150
|
+
|
|
151
|
+
|
|
142
152
|
def cmd_auth_login(
|
|
143
153
|
base_url: Annotated[str | None, cyclopts.Parameter(help=_BASE_URL_HELP)] = None,
|
|
144
154
|
*,
|
|
@@ -155,14 +165,21 @@ def cmd_auth_login(
|
|
|
155
165
|
|
|
156
166
|
Run with no arguments to renew an expired login: the instance URL and scope are read back from
|
|
157
167
|
the environment. The browser must be on this machine, because the login is completed through a
|
|
158
|
-
redirect to a local port
|
|
168
|
+
redirect to a local port. Over SSH, without a display, or with only a text browser, the device-code
|
|
169
|
+
flow (``auth device-code``) is used instead, unless ``--no-browser`` is given.
|
|
159
170
|
"""
|
|
160
171
|
params = _resolve_params(base_url, client_id, config_env, scope, set_default, config_file)
|
|
161
172
|
if params is None:
|
|
162
173
|
return
|
|
163
174
|
|
|
164
175
|
print(f"Requesting scope: {params.scope}", file=sys.stderr)
|
|
165
|
-
|
|
176
|
+
if not no_browser and not graphical_browser_available():
|
|
177
|
+
print(
|
|
178
|
+
"No graphical browser on this machine (remote session or text browser); using the device-code flow.",
|
|
179
|
+
file=sys.stderr,
|
|
180
|
+
)
|
|
181
|
+
_login_with_device_code(params, config_file, _DEVICE_CODE_TIMEOUT)
|
|
182
|
+
return
|
|
166
183
|
print("Waiting for login to complete...", file=sys.stderr)
|
|
167
184
|
try:
|
|
168
185
|
token = pkce_login(
|
|
@@ -186,7 +203,7 @@ def cmd_auth_device_code(
|
|
|
186
203
|
config_env: Annotated[str | None, cyclopts.Parameter(help=_CONFIG_ENV_HELP)] = None,
|
|
187
204
|
config_file: Annotated[Path, cyclopts.Parameter(help="Path to the config file.")] = DEFAULT_CONFIG_FILE,
|
|
188
205
|
scope: Annotated[str | None, cyclopts.Parameter(help=_SCOPE_HELP)] = None,
|
|
189
|
-
timeout: Annotated[float, cyclopts.Parameter(help="Seconds to wait for authorization.")] =
|
|
206
|
+
timeout: Annotated[float, cyclopts.Parameter(help="Seconds to wait for authorization.")] = _DEVICE_CODE_TIMEOUT,
|
|
190
207
|
set_default: Annotated[bool | None, cyclopts.Parameter(help=_SET_DEFAULT_HELP)] = None,
|
|
191
208
|
) -> None:
|
|
192
209
|
"""Authenticate via device code flow, for headless and remote environments.
|
|
@@ -199,9 +216,4 @@ def cmd_auth_device_code(
|
|
|
199
216
|
return
|
|
200
217
|
|
|
201
218
|
print(f"Requesting scope: {params.scope}", file=sys.stderr)
|
|
202
|
-
|
|
203
|
-
token = device_code_login(params.base_url, client_id=params.client_id, scope=params.scope, timeout=timeout)
|
|
204
|
-
except RuntimeError as e:
|
|
205
|
-
print(f"Error: {e}", file=sys.stderr)
|
|
206
|
-
raise SystemExit(1) from None
|
|
207
|
-
_persist(token, params, config_file)
|
|
219
|
+
_login_with_device_code(params, config_file, timeout)
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/workunit/upload.py
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
|
+
import threading
|
|
4
5
|
from contextlib import contextmanager
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
from typing import TYPE_CHECKING, Annotated, final
|
|
@@ -19,11 +20,13 @@ from rich.progress import (
|
|
|
19
20
|
TaskProgressColumn,
|
|
20
21
|
TextColumn,
|
|
21
22
|
TimeElapsedColumn,
|
|
23
|
+
TimeRemainingColumn,
|
|
22
24
|
TransferSpeedColumn,
|
|
23
25
|
)
|
|
24
26
|
|
|
25
27
|
from bfabric import Bfabric
|
|
26
28
|
from bfabric.operations.workunit import OnDuplicate, UploadFileParam, UploadFilesParams, upload_files
|
|
29
|
+
from bfabric.transfer.hash_cache import compute_hash_cache_path
|
|
27
30
|
from bfabric.utils.cli_integration import use_client
|
|
28
31
|
|
|
29
32
|
if TYPE_CHECKING:
|
|
@@ -55,8 +58,19 @@ class UploadParams(BaseModel):
|
|
|
55
58
|
"""Show a live upload progress bar. Pass ``--no-progress`` to disable; it is also
|
|
56
59
|
auto-disabled when stderr is not an interactive terminal."""
|
|
57
60
|
|
|
61
|
+
hash_workers: Annotated[int, cyclopts.Parameter(name="--hash-workers")] = 4
|
|
62
|
+
"""How many files to compute checksums for at the same time (``1`` = one at a time)."""
|
|
63
|
+
chunk_size: Annotated[int | None, cyclopts.Parameter(name="--chunk-size")] = None
|
|
64
|
+
"""Upload chunk size in MiB (``None`` uses 32). Larger chunks mean fewer round trips, which can raise
|
|
65
|
+
throughput on fast links, but a slow link may exceed a proxy's request timeout."""
|
|
66
|
+
hash_cache: bool = True
|
|
67
|
+
"""Reuse checksums of files whose size and modification time are unchanged since a previous run
|
|
68
|
+
(``~/.bfabric/hashes.json``). Pass ``--no-hash-cache`` to always re-read every file."""
|
|
69
|
+
|
|
58
70
|
@model_validator(mode="after")
|
|
59
71
|
def _validate_target(self) -> UploadParams:
|
|
72
|
+
if self.chunk_size is not None and self.chunk_size < 1:
|
|
73
|
+
raise ValueError("--chunk-size must be at least 1 (MiB).")
|
|
60
74
|
if self.workunit_id is not None:
|
|
61
75
|
if self.workunit_name is not None:
|
|
62
76
|
raise ValueError("--workunit-name and --workunit-id are mutually exclusive.")
|
|
@@ -91,6 +105,11 @@ def cmd_workunit_upload(params: UploadParams, *, client: Bfabric) -> None:
|
|
|
91
105
|
track_job=params.track_job,
|
|
92
106
|
),
|
|
93
107
|
on_progress=reporter.on_progress if reporter else None,
|
|
108
|
+
on_hash_progress=reporter.on_hash_progress if reporter else None,
|
|
109
|
+
on_hash_start=reporter.on_hash_start if reporter else None,
|
|
110
|
+
hash_workers=params.hash_workers,
|
|
111
|
+
chunk_size=params.chunk_size * 1024 * 1024 if params.chunk_size is not None else None,
|
|
112
|
+
hash_cache=compute_hash_cache_path().expanduser() if params.hash_cache else None,
|
|
94
113
|
on_start=reporter.on_start if reporter else None,
|
|
95
114
|
on_file_done=reporter.on_file_done if reporter else None,
|
|
96
115
|
)
|
|
@@ -133,6 +152,12 @@ class _UploadProgressReporter:
|
|
|
133
152
|
self._file_tasks: dict[str, TaskID] = {}
|
|
134
153
|
self._total_files = 0
|
|
135
154
|
self._done = 0
|
|
155
|
+
# Hashing runs on several threads, so its overall total is guarded.
|
|
156
|
+
self._hash_lock = threading.Lock()
|
|
157
|
+
self._hash_total_task: TaskID | None = None
|
|
158
|
+
self._hash_total = 0
|
|
159
|
+
self._hash_done = 0
|
|
160
|
+
self._hash_file_done: dict[str, int] = {}
|
|
136
161
|
|
|
137
162
|
def on_start(self, total_files: int, _total_bytes: int) -> None:
|
|
138
163
|
# _total_bytes is part of the on_start contract but unused: the overall bar is file-count only
|
|
@@ -140,6 +165,30 @@ class _UploadProgressReporter:
|
|
|
140
165
|
self._total_files = total_files
|
|
141
166
|
self._overall_task = self._overall.add_task("Overall", total=total_files)
|
|
142
167
|
|
|
168
|
+
def on_hash_start(self, _total_files: int, total_bytes: int) -> None:
|
|
169
|
+
if total_bytes > 0:
|
|
170
|
+
self._hash_total = total_bytes
|
|
171
|
+
self._hash_total_task = self._current.add_task("Hashing (all files)", total=total_bytes)
|
|
172
|
+
|
|
173
|
+
def on_hash_progress(self, filename: str, bytes_done: int, total: int) -> None:
|
|
174
|
+
key = f"hash:{filename}"
|
|
175
|
+
task_id = self._file_tasks.get(key)
|
|
176
|
+
if task_id is None:
|
|
177
|
+
task_id = self._current.add_task(f"Hashing {filename}", total=total)
|
|
178
|
+
self._file_tasks[key] = task_id
|
|
179
|
+
self._current.update(task_id, completed=bytes_done, total=total)
|
|
180
|
+
if bytes_done >= total:
|
|
181
|
+
self._current.remove_task(self._file_tasks.pop(key))
|
|
182
|
+
if self._hash_total_task is not None:
|
|
183
|
+
with self._hash_lock:
|
|
184
|
+
delta = bytes_done - self._hash_file_done.get(filename, 0)
|
|
185
|
+
self._hash_file_done[filename] = bytes_done
|
|
186
|
+
self._hash_done += delta
|
|
187
|
+
self._current.advance(self._hash_total_task, delta)
|
|
188
|
+
if self._hash_done >= self._hash_total:
|
|
189
|
+
self._current.remove_task(self._hash_total_task)
|
|
190
|
+
self._hash_total_task = None
|
|
191
|
+
|
|
143
192
|
def on_progress(self, filename: str, bytes_done: int, total: int) -> None:
|
|
144
193
|
task_id = self._file_tasks.get(filename)
|
|
145
194
|
if task_id is None:
|
|
@@ -183,6 +232,7 @@ def _upload_progress(*, enabled: bool) -> Iterator[_UploadProgressReporter | Non
|
|
|
183
232
|
TaskProgressColumn(),
|
|
184
233
|
DownloadColumn(),
|
|
185
234
|
TransferSpeedColumn(),
|
|
235
|
+
TimeRemainingColumn(),
|
|
186
236
|
console=console,
|
|
187
237
|
)
|
|
188
238
|
with Live(Group(overall, current), console=console, transient=True) as live:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_feeder_mascot.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_csv2dataset.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_dataset2csv.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_save_workflowstep.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_setWorkunitStatus.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_slurm_queue_status.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/bfabric_upload_resource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/api/output_format.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/cli_external_job.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/dataset/__init__.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/dataset/download.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/executable/__init__.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/executable/dump.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/executable/show.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/executable/upload.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/external_job/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/_constants.py
RENAMED
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/client_manage.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/register_webapp.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/login/service_account.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/workunit/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/cli/workunit/not_available.py
RENAMED
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/feeder/file_attributes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/fgcz_maxquant_wrapper.py
RENAMED
|
File without changes
|
{bfabric_scripts-1.18.0 → bfabric_scripts-1.19.0}/src/bfabric_scripts/fgcz_sge_maxquant_linux.bash
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|