|  | 
| 11 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
| 12 | 12 | # See the License for the specific language governing permissions and | 
| 13 | 13 | # limitations under the License. | 
|  | 14 | +from typing import TYPE_CHECKING, Optional | 
|  | 15 | + | 
| 14 | 16 | import click | 
| 15 | 17 | 
 | 
| 16 |  | -from rucio.cli.bin_legacy.rucio import list_dataset_replicas, list_file_replicas, list_suspicious_replicas | 
|  | 18 | +from rucio.cli.bin_legacy.rucio import list_dataset_replicas, list_datasets_rse, list_file_replicas, list_suspicious_replicas | 
| 17 | 19 | from rucio.cli.bin_legacy.rucio_admin import declare_bad_file_replicas, declare_temporary_unavailable_replicas, quarantine_replicas, set_tombstone | 
| 18 | 20 | from rucio.cli.utils import Arguments | 
| 19 | 21 | 
 | 
|  | 22 | +if TYPE_CHECKING: | 
|  | 23 | +    from collections.abc import Sequence | 
|  | 24 | + | 
| 20 | 25 | 
 | 
| 21 | 26 | @click.group() | 
| 22 | 27 | def replica(): | 
| @@ -60,13 +65,18 @@ def list_(ctx, dids, protocols, all_states, pfns, domain, link, missing, metalin | 
| 60 | 65 | 
 | 
| 61 | 66 | @replica_list.command("dataset") | 
| 62 | 67 | @click.argument("dids", nargs=-1) | 
|  | 68 | +@click.option("--rse", default=None, help="RSE name to use a filter") | 
| 63 | 69 | @click.option("--deep", default=False, is_flag=True, help="Make a deep check, checking the contents of datasets in datasets") | 
| 64 | 70 | @click.option("--csv", help="Write output to comma separated values", is_flag=True, default=False) | 
| 65 | 71 | @click.pass_context | 
| 66 |  | -def list_dataset(ctx, dids, deep, csv): | 
| 67 |  | -    """List dataset replicas""" | 
| 68 |  | -    args = Arguments({"no_pager": ctx.obj.no_pager, "dids": dids, "deep": deep, "csv": csv}) | 
| 69 |  | -    list_dataset_replicas(args, ctx.obj.client, ctx.obj.logger, ctx.obj.console, ctx.obj.spinner) | 
|  | 72 | +def list_dataset(ctx, dids: Optional["Sequence[str]"], rse: Optional[str], deep: bool, csv: bool): | 
|  | 73 | +    """List dataset replicas, or view all datasets at a RSE""" | 
|  | 74 | +    if rse is None: | 
|  | 75 | +        args = Arguments({"no_pager": ctx.obj.no_pager, "dids": dids, "deep": deep, "csv": csv}) | 
|  | 76 | +        list_dataset_replicas(args, ctx.obj.client, ctx.obj.logger, ctx.obj.console, ctx.obj.spinner) | 
|  | 77 | +    else: | 
|  | 78 | +        args = Arguments({"no_pager": ctx.obj.no_pager, "rse": rse}) | 
|  | 79 | +        list_datasets_rse(args, ctx.obj.client, ctx.obj.logger, ctx.obj.console, ctx.obj.spinner) | 
| 70 | 80 | 
 | 
| 71 | 81 | 
 | 
| 72 | 82 | @replica.command("remove") | 
|  | 
0 commit comments