reimplement buildafi deprecation warning

Implementation that used warn(DeprecationWarning) wasn't printing to output or being logged
implement it with more straightforward logging messages and by changing taskname to buildbitstream
This commit is contained in:
Tim Snyder 2022-04-21 14:33:21 +00:00
parent d24dbdd6c3
commit d086ed8a0c
3 changed files with 13 additions and 7 deletions

View File

@ -23,7 +23,6 @@ from awstools.awstools import awsinit, get_aws_userid
from awstools.afitools import *
from buildtools.buildconfigfile import BuildConfigFile
from buildtools.buildconfig import BuildConfig
from util.streamlogger import StreamLogger
@ -86,7 +85,7 @@ def register_task(task: Callable) -> Callable:
# we don't want this function to be callable any way other than via firesim.main()
# so that we know programmatic changes to TASKS are followed (currently for testing purposes)
# so we don't return the original callable task, we return a lambda that raises
def inner():
def inner(*args, **kwargs):
raise FiresimTaskAccessViolation(f"Called '{tn}' without going through TASKS")
# or actually, we define a closure with def and return that because lambdas that raise
# are convoluted
@ -147,8 +146,8 @@ def runworkload(runtime_conf: RuntimeConfig) -> None:
@register_task
def buildafi(build_config_file: BuildConfigFile) -> None:
warn("buildafi is deprecated. buildbitstream is the new name from version=1.14.0", DeprecationWarning, stacklevel=1)
buildbitstream(build_config_file)
# shouldn't ever be able to get here because main() implements logging and redirecting to builtbitstream
raise NotImplementedError
@register_task
def buildbitstream(build_config_file: BuildConfigFile) -> None:
@ -333,6 +332,10 @@ def main(args: argparse.Namespace) -> None:
# different keys. also, probably won't get MITM'd
env.disable_known_hosts = True
if args.task == 'buildafi':
rootLogger.warning("From v1.14.0, 'buildafi' is renamed to 'buildbitream' and will be removed in a future version")
args.task = 'buildbitstream'
rootLogger.info("FireSim Manager. Docs: http://docs.fires.im\nRunning: %s\n", str(args.task))
t = TASKS[args.task]
@ -364,6 +367,9 @@ if __name__ == '__main__':
randname = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(16))
return timeline + "-" + args.task + "-" + randname + ".log"
# treat python warnings as WARNING level messages from py.warn
logging.captureWarnings(True)
rootLogger = logging.getLogger()
rootLogger.setLevel(logging.NOTSET) # capture everything

View File

@ -54,7 +54,7 @@ end up with something like this (a line beginning with a ``#`` is a comment):
[builds]
# this section references builds defined in config_build_recipes.ini
# if you add a build here, it will be built when you run buildafi
# if you add a build here, it will be built when you run buildbitstream
firesim-rocket-quadcore-no-nic-l2-llc4mb-ddr3
@ -65,7 +65,7 @@ Now, we can run a build like so:
::
firesim buildafi
firesim buildbitstream
This will run through the entire build process, taking the Chisel RTL
and producing an AFI/AGFI that runs on the FPGA. This whole process will

View File

@ -6,6 +6,6 @@ set -o pipefail
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source $SCRIPT_DIR/defaults.sh
run "cd firesim/ && source sourceme-f1-manager.sh && firesim buildafi"
run "cd firesim/ && source sourceme-f1-manager.sh && firesim buildbitstream"
echo "Success"