diff --git a/packages/agebd/pyproject.toml b/packages/agebd/pyproject.toml index 6b6ec64..eacc2a9 100644 --- a/packages/agebd/pyproject.toml +++ b/packages/agebd/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "slc-hla-framework" +name = "agebd" version = "0.1.0" description = "SLS HLA Framework" readme = "README.md" @@ -9,8 +9,7 @@ authors = [ ] dependencies = [ - "h5py>=3.14.0", - "numpy>=2.0.2", + # TODO: use systems epics "pyepics>=3.5.8", "typer>=0.23.2", ] @@ -40,7 +39,6 @@ package = true include = [ "src/**/*.py", "tests/**/*.py", - "AGEBD-SERVICE-TEMPLATE.py" ] line-length = 100 diff --git a/packages/agebd/src/agebd/utils.py b/packages/agebd/src/agebd/utils.py index 9629f9d..beeb02d 100644 --- a/packages/agebd/src/agebd/utils.py +++ b/packages/agebd/src/agebd/utils.py @@ -24,3 +24,26 @@ def init_logging(log_level: LogLevel): Configure logging -- set log level """ logging.basicConfig(level=getattr(logging, log_level.upper())) + + +def printgetversion(filehandle): + """ + Print and get version identifier based on the last + modified time of the filehandle. + """ + + # Get the path of the current script + script_path = os.path.abspath(filehandle) + + # Get the last modification time (in seconds since the epoch) + last_modified_timestamp = os.path.getmtime(script_path) + + # Convert to a datetime object + last_modified_datetime = datetime.fromtimestamp(last_modified_timestamp) + + # Format the datetime object as "YYYY-MM-DD HH:MM:SS" + formatted_time = last_modified_datetime.strftime("%Y-%m-%d %H:%M:%S") + + print(f"Last modified: {formatted_time}") + + return formatted_time[:10] diff --git a/services/000-master/app/AGEBD-SERVICE-MASTER.py b/services/000-master/app/AGEBD-SERVICE-MASTER.py index 830d0ba..004d58d 100644 --- a/services/000-master/app/AGEBD-SERVICE-MASTER.py +++ b/services/000-master/app/AGEBD-SERVICE-MASTER.py @@ -15,8 +15,8 @@ Usage: screen -S MASTER bash -c 'source /opt/gfa/python ; python AGEBD-SERVICE-M import traceback import html -import numpy as np -from AGEBD import printgetversion, pvlink as PV +from agebd.pv import PVLink as PV +from agebd.utils import printgetversion from time import sleep, perf_counter from datetime import datetime import subprocess @@ -305,4 +305,4 @@ else: # confirm unknown exit pvs.status.put('unknown crash') print('Service crashed without exception!') - print(traceback.format_exc()) \ No newline at end of file + print(traceback.format_exc())