Skip to content

Commit

Permalink
Merge pull request #4 from bbrzycki/settrace
Browse files Browse the repository at this point in the history
Adjust syntax
  • Loading branch information
bbrzycki authored Aug 1, 2023
2 parents ebba15f + f094939 commit 2036671
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion jort/reporting_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def execute(self, payload):
message.attach(MIMEText(email_data["html_body"], "html"))

if payload["stdout_fn"] is not None:
stdout_path = f'{config.JORT_DIR}/{payload["stdout_fn"]}'
stdout_path = os.path.join(config._get_data_dir(), payload["stdout_fn"])
with open(stdout_path, "r") as f:
attachment = MIMEApplication(f.read(), _subtype="txt")
attachment.add_header("Content-Disposition", "attachment", filename="output.txt")
Expand Down
2 changes: 1 addition & 1 deletion jort/track_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def track_new(command,
# Key for storing stdout text to file
if save_filename or store_stdout:
stdout_fn = f"{shortuuid.uuid()}.txt"
stdout_path = os.path.join(config._get_data_dir(), stdout_fn)
stdout_path = os.path.join(config._get_data_dir(), stdout_fn)
else:
stdout_fn = None

Expand Down
10 changes: 6 additions & 4 deletions jort/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ class Tracker(object):
Parameters
----------
session_name : str, optional
Name of job session, if saving jobs to database
log_name : str
Filename for timing logs
verbose : int, optional
Options for verbosity. 0 for none, 1 for INFO, and 2 for DEBUG.
to_db : bool, optional
Save all block runtime details to database
session_name : str, optional
Name of job session, if saving jobs to database
:ivar date_created: time of initialization
:ivar machine: name of local machine
Expand All @@ -46,7 +46,7 @@ class Tracker(object):
:iver to_db: option to save all blocks to database
:iver session_name: name of job session
"""
def __init__(self, log_name="tracker.log", verbose=0, to_db=False, session_name=None):
def __init__(self, session_name=None, log_name="tracker.log", verbose=0, to_db=False):
self.date_created = datetime_utils.get_iso_date()
self.machine = socket.gethostname() #config._get_config_data().get("machine")
self.blocks = {}
Expand Down Expand Up @@ -315,10 +315,12 @@ def report(self, dec=1):
dec : int
Decimal precision
"""
print()
print(f"Session: {self.session_name}")
for name in self.blocks:
block = self.blocks[name]
print(block.report(dec=dec))

print()

def exec(self, code_string):
"""
Expand Down

0 comments on commit 2036671

Please sign in to comment.