diff --git a/renku/cli/log.py b/renku/cli/log.py index b0a6796bed..182a2cb62e 100644 --- a/renku/cli/log.py +++ b/renku/cli/log.py @@ -23,10 +23,27 @@ .. code-block:: console $ renku log - DATE TYPE DESCRIPTION - ------------------- ---- ------------- - 2021-09-21 15:46:02 Run cp A C - 2021-09-21 10:52:51 Run cp A B + Activity /activities/be60896d8d984a0bb585e53f7a3146dc + Start Time: 2022-02-03T13:56:27+01:00 + End Time: 2022-02-03T13:56:28+01:00 + User: John Doe + Renku Version: renku 1.0.5 + Command: python test.py + Inputs: + input-1: test.py + Parameters: + text: hello + + Dataset testset + Date: 2022-02-03T11:26:55+01:00 + Changes: created + Title set to: testset + Creators modified: + + John Doe + +To show only dataset entries, use ``-d``, to show only workflows, use ``-w``. + +You can select a format using the ``--format `` argument. .. cheatsheet:: :group: Misc diff --git a/renku/core/commands/log.py b/renku/core/commands/log.py index 69f20e5fec..03d649daa5 100644 --- a/renku/core/commands/log.py +++ b/renku/core/commands/log.py @@ -17,6 +17,7 @@ # limitations under the License. """Log of renku commands.""" +from typing import List from renku.core.commands.view_model.log import LogViewModel from renku.core.management.command_builder import Command, inject from renku.core.management.interface.activity_gateway import IActivityGateway @@ -35,7 +36,7 @@ def _log( dataset_gateway: IDatasetGateway, workflows_only: bool = False, datasets_only: bool = False, -): +) -> List[LogViewModel]: """Get a log of renku commands.""" def _get_all_dataset_versions(dataset: Dataset): diff --git a/renku/core/commands/view_model/log.py b/renku/core/commands/view_model/log.py index 4d1131a180..6d5aaefde6 100644 --- a/renku/core/commands/view_model/log.py +++ b/renku/core/commands/view_model/log.py @@ -20,7 +20,7 @@ from dataclasses import asdict, dataclass from datetime import datetime from enum import Enum -from typing import TYPE_CHECKING, List, Optional, Tuple +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import inject @@ -100,12 +100,12 @@ def __init__( self.description = description self.agents = agents - def to_dict(self): + def to_dict(self) -> Dict[str, Any]: """Return a dict representation of this view model.""" raise NotImplementedError() @classmethod - def from_activity(cls, activity: "Activity"): + def from_activity(cls, activity: "Activity") -> "ActivityLogViewModel": """Create a log entry from an activity.""" from renku.core.models.provenance.agent import Person, SoftwareAgent @@ -144,7 +144,7 @@ def from_activity(cls, activity: "Activity"): ) @classmethod - def from_dataset(cls, dataset: "Dataset"): + def from_dataset(cls, dataset: "Dataset") -> Optional["DatasetLogViewModel"]: """Create a log entry from an activity.""" from renku.core.management.interface.dataset_gateway import IDatasetGateway from renku.core.models.dataset import DatasetChangeType @@ -269,7 +269,7 @@ def __init__( super().__init__(id, date, description, agents) self.details = details - def to_dict(self): + def to_dict(self) -> Dict[str, Any]: """Return a dict representation of this view model.""" return { "date": self.date.isoformat(), @@ -289,7 +289,7 @@ def __init__(self, id: str, date: datetime, description: str, details: ActivityD super().__init__(id, date, description, agents) self.details = details - def to_dict(self): + def to_dict(self) -> Dict[str, Any]: """Return a dict representation of this view model.""" return { "date": self.date.isoformat(),