Skip to content

Commit

Permalink
Merge pull request #103 from siliconcompiler/clean
Browse files Browse the repository at this point in the history
switch gallery from resume to clean
  • Loading branch information
gadfort authored Jul 9, 2024
2 parents 212875b + 9b04113 commit 4329e15
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion scgallery/designs/zerosoc/run_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def runtime_setup(gallery):
build = init_zerosoc()
core_chip = build.build_core(remote=False,
verify=False,
resume=gallery.is_resume,
resume=not gallery.is_clean,
floorplan=False)
return build.setup_top_hier(core_chip)
34 changes: 17 additions & 17 deletions scgallery/gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, name=None, path=None):
self.__report_chips = {}

self.__jobname = None
self.set_resume(False)
self.set_clean(False)
self.set_remote(None)
self.set_strict(True)
self.set_rules_to_skip(None)
Expand Down Expand Up @@ -255,28 +255,28 @@ def is_remote(self):
return False

#######################################################
def set_resume(self, resume):
def set_clean(self, clean):
'''
Set if the gallery should resume a previous run.
Set if the gallery should clean a previous run.
Parameters:
resume (boolean): Flag to indicate if resume should be used
clean (boolean): Flag to indicate if clean should be used
'''
if resume:
resume = True
if clean:
clean = True
else:
resume = False
self.__resume = resume
clean = False
self.__clean = clean

@property
def is_resume(self):
def is_clean(self):
'''
Determine if the gallery is set to resume a previous run
Determine if the gallery is set to clean a previous run
Returns:
boolean: True, if resuming, False if not
'''
return self.__resume
return self.__clean

#######################################################
def set_strict(self, strict):
Expand Down Expand Up @@ -305,10 +305,10 @@ def is_strict(self):
###################################################
def set_rules_to_skip(self, rules):
'''
Set if the gallery should resume a previous run.
Set rules to skip during checks
Parameters:
rules (list): Flag to indicate if resume should be used
rules (list): List of glob rules
'''
if not rules:
rules = []
Expand Down Expand Up @@ -485,7 +485,7 @@ def __run_design(self, design):
chip.set('option', 'quiet', True)
chip.set('option', 'strict', self.is_strict)

chip.set('option', 'clean', not self.is_resume)
chip.set('option', 'clean', self.is_clean)

if self.is_remote:
chip.set('option', 'credentials', self.__remote)
Expand Down Expand Up @@ -815,9 +815,9 @@ def format_list(items, prefix_len, max_len=80):
help='Perform a remote run, '
'optionally provides path to remote credentials')

parser.add_argument('-resume',
parser.add_argument('-clean',
action='store_true',
help='Use option,resume')
help='Use option,clean')

parser.add_argument('-gallery',
metavar='<module>',
Expand All @@ -837,7 +837,7 @@ def format_list(items, prefix_len, max_len=80):
args = parser.parse_args()

gallery.set_path(args.path)
gallery.set_resume(args.resume)
gallery.set_clean(args.clean)
gallery.set_remote(args.remote)

if args.target:
Expand Down
6 changes: 3 additions & 3 deletions scripts/generate_image_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def print_github(print_size):
print(f"Total jobs on github: {len(github_jobs)}")


def run_cache(resume, dry_run):
def run_cache(clean, dry_run):
from scgallery import Gallery

cached_jobs = [job for job in all_jobs if "cache" in job and job["cache"]]
Expand All @@ -41,7 +41,7 @@ def run_cache(resume, dry_run):
gal = Gallery()
gal.set_run_designs([job['design']])
gal.set_run_targets([job['target']])
gal.set_resume(resume)
gal.set_clean(clean)
print(f"{job['design']} - {job['target']}")

if not dry_run:
Expand Down Expand Up @@ -84,5 +84,5 @@ def run_cache(resume, dry_run):
sys.exit(0)

if args.generate_cache:
run_cache(not args.dont_resume, args.dry_run)
run_cache(args.dont_resume, args.dry_run)
sys.exit(0)
12 changes: 6 additions & 6 deletions tests/test_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ def test_set_remote_invalid_file():
gallery.set_remote("file not found")


def test_set_unset_resume():
def test_set_unset_clean():
gallery = Gallery()

assert not gallery.is_resume
gallery.set_resume(True)
assert gallery.is_resume
gallery.set_resume(False)
assert not gallery.is_resume
assert not gallery.is_clean
gallery.set_clean(True)
assert gallery.is_clean
gallery.set_clean(False)
assert not gallery.is_clean


def test_set_unset_strict():
Expand Down

0 comments on commit 4329e15

Please sign in to comment.