Skip to content

Commit

Permalink
working towards bastion as a planner and performer that can consume i…
Browse files Browse the repository at this point in the history
…ts own plans; also redis enabled alternative.
  • Loading branch information
ndenny committed Apr 25, 2025
1 parent 1e66ed1 commit 55f0503
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
25 changes: 25 additions & 0 deletions bin/bastion.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,21 @@ def do_enroll_assets(self, request):

return request.succeeded(None, report="Assets enrolled and catalog written to {}".format(catalog_path))

def _generate_update_plan(self, request):
"""
Given a request to update a site, zone, or asset,
I generate an update plan as a list of requests to be performed.
"""
raise NotImplementedError

def do_export_update_plan(self, request):
"""
I generate an update plan for the given site, zone, or asset.
I write the update plan to STDOUT as a list of requests in YAML format.
"""
tasks = self._generate_update_plan(request)
raise NotImplementedError


if __name__ == '__main__':
app = App().configured()
Expand Down Expand Up @@ -904,3 +919,13 @@ def do_enroll_assets(self, request):
#bastion JSON! list sites banked fortress
#bastion YAML! list sites banked fortress
#bastion PROSE! list sites banked fortress

#bastion queue update plan {site}
#bastion queue update plan {site} {zone}
#bastion queue update plan {ark}
#bastion export update plan {site}
#bastion export update plan {site} {zone}
#bastion export update plan {ark}

#bastion perform request filed
#bastion perform request queued
25 changes: 25 additions & 0 deletions lib/Bastion/Model.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,31 @@ def unpack(self, halo, root, **kwargs):
raise NotImplementedError


class isPlanner(isPerformer):
"""
Abstract class for planning archival operations on assets.
Planning is the process of determining what needs to be done to a given asset.
"""
def __init__(self, app):
self.app = app #-- I need a handle to the application object.

def plan(self, *args):
"""
plan(asset) - given an asset, I answer a plan for the asset.
plan(ark) - given an ARK, I answer a plan for the asset.
plan(site) - given a site, I answer a plan for all assets in the site.
plan(site, zone) - given a site and a zone, I answer a plan for all assets in the given zone.
plan(site, zone, asset) - given a site, zone, and asset name, I answer a plan for the asset.
"""
raise NotImplementedError

def _plan_asset(self, asset):
"""
I answer a plan for the given asset.
"""
raise NotImplementedError


class isMover(isPerformer):
"""
Expand Down

0 comments on commit 55f0503

Please sign in to comment.