Skip to content

Commit

Permalink
python3.12 changes (pkg_resources, utcnow)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnfait committed Mar 5, 2024
1 parent 76ef048 commit eecf06f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import importlib.resources
import logging
import os

import boto3
import pkg_resources

from .artifact import Artifact, ArtifactAPI
from .config import ConfigParser
Expand All @@ -17,9 +17,9 @@ def __init__(self):
self.logger = logging.getLogger(__name__)
self.region = "us-east-1"
self.profile = "default"
self.configuration_file = pkg_resources.resource_filename(__name__, "octagon-configuration.json")
self.configuration_file = importlib.resources.files(__name__) / "octagon-configuration.json"
self.configuration_instance = "dev"
self.metadata_file = pkg_resources.resource_filename(__name__, "octagon-metadata.json")
self.metadata_file = importlib.resources.files(__name__) / "octagon-metadata.json"
self.initialized = False
self.run_in_fargate = False
self.run_in_lambda = False
Expand Down
8 changes: 4 additions & 4 deletions sdlf-datalakeLibrary/python/datalake_library/octagon/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@


def get_duration_sec(start_timestamp_str, end_timestamp_str):
ts_format = "%Y-%m-%dT%H:%M:%S.%f"
start_ts = datetime.datetime.strptime(start_timestamp_str[:-1], ts_format)
end_ts = datetime.datetime.strptime(end_timestamp_str[:-1], ts_format)
ts_format = "%Y-%m-%dT%H:%M:%S.%f%z"
start_ts = datetime.datetime.strptime(start_timestamp_str, ts_format)
end_ts = datetime.datetime.strptime(end_timestamp_str, ts_format)
return (end_ts - start_ts).total_seconds()


# datetime.datetime.now(datetime.UTC)
def get_timestamp_iso(current_time=datetime.datetime.now(datetime.UTC)):
return current_time.isoformat()[:-3] + "Z"
return current_time.isoformat()


# Return local date ISO formatted
Expand Down

0 comments on commit eecf06f

Please sign in to comment.