Skip to content

Commit

Permalink
Fix typos in documentation and log messages (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
djperrefort authored Aug 15, 2023
1 parent 0262fee commit 816fcd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
13 changes: 7 additions & 6 deletions lmod_ingest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
lmod_ingest --version
Options:
-h --help Show this help text
<path> Path of the log data to ingest
--sql Print migration SQL but do not execute it
--version Show the application version number
-h --help Show this help text
<path> Path of the log data to ingest
--sql Print migration SQL but do not execute it
--version Show the application version number
"""

import logging
Expand Down Expand Up @@ -42,9 +42,10 @@ def ingest(path: Path) -> None:
"""Ingest data from a log file into the application database
Args:
path: Path of the lg file
path: Path of the log file
"""

logging.info(f'Ingesting {path.resolve()}')
db_engine = sa.engine.create_engine(url=fetch_db_url())
with db_engine.connect() as connection:
data = parse_log_data(path)
Expand Down Expand Up @@ -78,4 +79,4 @@ def main():
migrate(arguments['--sql'])

except Exception as caught:
logging.error(str(caught))
logging.error(caught)
8 changes: 4 additions & 4 deletions lmod_ingest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def fetch_db_url() -> str:
"""Fetch DB connection settings from environment variables
Returns:
A sqlalchemy compatible database URL
A SQLAlchemy compatible database URL
Raises:
RuntimeError: If the username or password is not defined in the environment
Expand All @@ -37,7 +37,7 @@ def fetch_db_url() -> str:
def parse_log_data(path: Path) -> pd.DataFrame:
"""Parse, format, and return data from an Lmod log file
The returned dataframe is formatted using the same data model assumed
The returned DataFrame is formatted using the same data model assumed
by the ingestion database.
Args:
Expand All @@ -49,7 +49,7 @@ def parse_log_data(path: Path) -> pd.DataFrame:

logging.info(f'Parsing log data')

# Expect columns to be seperated by whitespace and use ``=`` as a secondary
# Expect columns to be separated by whitespace and use ``=`` as a secondary
# delimiter to automatically split up strings like "user=admin123" into two columns
log_data = pd.read_table(
path,
Expand All @@ -60,7 +60,7 @@ def parse_log_data(path: Path) -> pd.DataFrame:
engine='python'
)

# Convert UTC decimals to a MYSql compatible string format
# Convert UTC decimals to a MySQL compatible string format
log_data['time'] = pd.to_datetime(log_data['time'], unit='s').dt.strftime('%Y-%m-%d %H:%M:%S.%f')

# Split the module name into package names and versions
Expand Down

0 comments on commit 816fcd4

Please sign in to comment.