You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cursor: The cursor object from the connection to the SQLite database.
173
181
entity_id: The entity ID to check.
182
+
synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor.
force: If running in an interactive shell, migration requires an interactice confirmation.
580
593
This can be bypassed by using the force=True option. Defaults to False.
594
+
synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor.
581
595
582
596
Returns:
583
597
True if migration should proceed, False otherwise.
@@ -592,7 +606,7 @@ def _confirm_migration(
592
606
).fetchone()[0]
593
607
594
608
ifcount==0:
595
-
logger.info("No items for migration.")
609
+
synapse_client.logger.info("No items for migration.")
596
610
returnFalse
597
611
598
612
ifsys.stdout.isatty():
@@ -601,11 +615,10 @@ def _confirm_migration(
601
615
)
602
616
returnuser_input.strip().lower() =="y"
603
617
else:
604
-
logger.info(
605
-
"%s items for migration. "
618
+
synapse_client.logger.info(
619
+
f"{count} items for migration. "
606
620
"force option not used, and console input not available to confirm migration, aborting. "
607
-
"Use the force option or run from an interactive shell to proceed with migration.",
608
-
count,
621
+
"Use the force option or run from an interactive shell to proceed with migration."
file_version_strategy: Strategy for file versions.
808
821
include_table_files: Whether to include table-attached files.
809
822
continue_on_error: Whether to continue on errors.
810
-
synapse_client: The Synapse client.
823
+
synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor.
source_storage_location_ids: List of source storage locations.
896
909
file_version_strategy: Strategy for file versions.
897
-
synapse_client: The Synapse client.
910
+
synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor.
source_storage_location_ids: List of source storage locations to filter.
1007
1019
synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor.
"""Create a new version of a file entity with the new file handle.
1215
1227
1216
1228
Arguments:
1217
1229
entity_id: The file entity ID.
1218
1230
to_file_handle_id: The new file handle ID.
1219
-
synapse_client: The Synapse client.
1231
+
synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor.
"""Migrate/update an existing file version with a new file handle.
1242
1253
1243
1254
Arguments:
1244
-
entity_id: The file entity ID.
1245
-
version: The version number.
1255
+
entity_id: The Synapse ID of the entity.
1256
+
version: The version number of the entity.
1246
1257
from_file_handle_id: The original file handle ID.
1247
1258
to_file_handle_id: The new file handle ID.
1248
-
synapse_client: The Synapse client.
1259
+
synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor.
This is the second step in migrating files to a new storage location.
1368
1372
Files must first be indexed using `index_files_for_migration_async`.
1369
1373
1374
+
**Interactive confirmation:** When called from an interactive shell and
1375
+
`force=False` (the default), this function will print the number of items
1376
+
queued for migration and prompt the user to confirm before proceeding
1377
+
(``"N items for migration to <location>. Proceed? (y/n)?``). If standard
1378
+
output is not connected to an interactive terminal (e.g. a script or CI
1379
+
environment), migration is aborted unless ``force=True`` is set.
1380
+
1370
1381
Arguments:
1371
1382
db_path: Path to SQLite database created by index_files_for_migration_async.
1372
1383
create_table_snapshots: Whether to create table snapshots before migrating. Defaults to True.
1373
1384
continue_on_error: Whether to continue on individual migration errors. Defaults to False.
1374
-
force: If running in an interactive shell, migration requires an interactice confirmation.
1375
-
This can be bypassed by using the force=True option. Defaults to False.
1376
-
max_concurrent_copies: Maximum concurrent file copy operations. Defaults to None.
1385
+
force: Skip the interactive confirmation prompt and proceed with migration
1386
+
automatically. Set to ``True`` when running non-interactively (scripts,
1387
+
CI, automated pipelines). Defaults to False.
1377
1388
synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor.
1378
1389
1379
1390
Returns:
1380
-
MigrationResult object or None if migration was aborted.
1391
+
MigrationResult object, or None if migration was aborted (user declined
1392
+
the confirmation prompt, or the session is non-interactive and force=False).
create_table_snapshots: Whether to create table snapshots.
1431
1445
continue_on_error: Whether to continue on errors.
1432
1446
max_concurrent: Maximum concurrent operations.
1433
-
synapse_client: The Synapse client.
1447
+
synapse_client: If not passed in and caching was not disabled by `Synapse.allow_client_caching(False)` this will use the last created instance from the Synapse class constructor.
0 commit comments