Skip to content

Commit

Permalink
Add git commit to output of demo scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
1kastner committed May 26, 2024
1 parent f2d46e8 commit 5effb75
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/Python_Script/demo_DEHAM_CTA.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import random
import sys
import pandas as pd
import subprocess

Check notice on line 28 in examples/Python_Script/demo_DEHAM_CTA.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_DEHAM_CTA.py#L28

standard import "import subprocess" should be placed before "import pandas as pd" (wrong-import-order)

try:
import conflowgen
Expand Down Expand Up @@ -322,4 +323,9 @@
# Gracefully close everything
database_chooser.close_current_connection()
logger.info(f"ConFlowGen {conflowgen.__version__} from {conflowgen.__file__} was used.")
try:
last_git_commit = str(subprocess.check_output(["git", "log", "-1"]).strip())

Check notice on line 327 in examples/Python_Script/demo_DEHAM_CTA.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_DEHAM_CTA.py#L327

Starting a process with a partial executable path (B607)
logger.info("Used git commit: " + last_git_commit[2:-1])
except:

Check notice on line 329 in examples/Python_Script/demo_DEHAM_CTA.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_DEHAM_CTA.py#L329

No exception type(s) specified (bare-except)
logger.debug("The last git commit of this repository could not be retrieved, no further version specification.")
logger.info("Demo 'demo_DEHAM_CTA' finished successfully.")
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import random
import sys
import pandas as pd
import subprocess

Check notice on line 28 in examples/Python_Script/demo_DEHAM_CTA__with_ramp_up_and_ramp_down_period.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_DEHAM_CTA__with_ramp_up_and_ramp_down_period.py#L28

standard import "import subprocess" should be placed before "import pandas as pd" (wrong-import-order)

try:
import conflowgen
Expand Down Expand Up @@ -326,4 +327,9 @@
# Gracefully close everything
database_chooser.close_current_connection()
logger.info(f"ConFlowGen {conflowgen.__version__} from {conflowgen.__file__} was used.")
try:
last_git_commit = str(subprocess.check_output(["git", "log", "-1"]).strip())

Check notice on line 331 in examples/Python_Script/demo_DEHAM_CTA__with_ramp_up_and_ramp_down_period.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_DEHAM_CTA__with_ramp_up_and_ramp_down_period.py#L331

Starting a process with a partial executable path (B607)
logger.info("Used git commit: " + last_git_commit[2:-1])
except:

Check notice on line 333 in examples/Python_Script/demo_DEHAM_CTA__with_ramp_up_and_ramp_down_period.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_DEHAM_CTA__with_ramp_up_and_ramp_down_period.py#L333

No exception type(s) specified (bare-except)
logger.debug("The last git commit of this repository could not be retrieved, no further version specification.")
logger.info("Demo 'demo_DEHAM_CTA_with_ramp_up_and_down_period' finished successfully.")
6 changes: 6 additions & 0 deletions examples/Python_Script/demo_continental_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import random
import sys
import pandas as pd
import subprocess

Check notice on line 11 in examples/Python_Script/demo_continental_gateway.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_continental_gateway.py#L11

standard import "import subprocess" should be placed before "import pandas as pd" (wrong-import-order)

try:
import conflowgen
Expand Down Expand Up @@ -196,4 +197,9 @@
database_chooser.close_current_connection()

logger.info(f"ConFlowGen {conflowgen.__version__} from {conflowgen.__file__} was used.")
try:
last_git_commit = str(subprocess.check_output(["git", "log", "-1"]).strip())

Check notice on line 201 in examples/Python_Script/demo_continental_gateway.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_continental_gateway.py#L201

Starting a process with a partial executable path (B607)
logger.info("Used git commit: " + last_git_commit[2:-1])
except:

Check notice on line 203 in examples/Python_Script/demo_continental_gateway.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_continental_gateway.py#L203

No exception type(s) specified (bare-except)
logger.debug("The last git commit of this repository could not be retrieved, no further version specification.")
logger.info("Demo 'demo_continental_gateway' finished successfully.")
7 changes: 7 additions & 0 deletions examples/Python_Script/demo_poc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import datetime
import os
import sys
import subprocess

try:
import conflowgen
Expand All @@ -25,6 +26,7 @@
print("Please first install ConFlowGen, e.g. with conda or pip")
raise exc


this_dir = os.path.dirname(__file__)

with_visuals = False
Expand Down Expand Up @@ -137,4 +139,9 @@
# Gracefully close everything
database_chooser.close_current_connection()
logger.info(f"ConFlowGen {conflowgen.__version__} from {conflowgen.__file__} was used.")
try:
last_git_commit = str(subprocess.check_output(["git", "log", "-1"]).strip())

Check notice on line 143 in examples/Python_Script/demo_poc.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_poc.py#L143

Starting a process with a partial executable path (B607)
logger.info("Used git commit: " + last_git_commit[2:-1])
except:

Check notice on line 145 in examples/Python_Script/demo_poc.py

View check run for this annotation

codefactor.io / CodeFactor

examples/Python_Script/demo_poc.py#L145

No exception type(s) specified (bare-except)
logger.debug("The last git commit of this repository could not be retrieved, skip this.")
logger.info("Demo 'demo_poc' finished successfully.")

0 comments on commit 5effb75

Please sign in to comment.