Add append_timestamp option for trace action

This commit is contained in:
Christophe Bedard 2019-08-04 13:04:44 +02:00
parent 2a7f857cc4
commit 5b2280d543
3 changed files with 17 additions and 1 deletions

View file

@ -42,7 +42,7 @@ def parse_args():
def add_arguments(parser):
parser.add_argument(
'--session-name', '-s', dest='session_name',
default=f'session-{time.strftime("%Y%m%d%H%M%S")}',
default=path.append_timestamp('session'),
help='the name of the tracing session (default: session-YYYYMMDDHHMMSS)')
parser.add_argument(
'--path', '-p', dest='path',

View file

@ -13,11 +13,24 @@
# limitations under the License.
import os
import time
DEFAULT_BASE_PATH = '~/.ros/tracing/'
def append_timestamp(
session_name_base: str,
) -> str:
"""
Append timestamp to base session name.
:param session_name_base: the base name of the tracing session
:return: the session name with timestamp
"""
return session_name_base + '-' + time.strftime("%Y%m%d%H%M%S")
def get_full_session_path(
session_name: str,
base_path: str = DEFAULT_BASE_PATH