RadCluster
Graph-based cluster dynamics for irradiated materials
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
gitsync.CampaignSync Class Reference
+ Collaboration diagram for gitsync.CampaignSync:

Public Member Functions

 __init__ (self, Path repo_root, str branch=DEFAULT_BRANCH, Path sync_dir=SYNC_DIR, str remote="origin", bool offline=False)
 
 ensure (self)
 
 refresh (self)
 
dict claims (self)
 
bool claim (self, str run_id, dict meta=None)
 
str|None next_unclaimed (self, list[str] run_ids)
 
bool publish (self, str run_id, dict summary, dict artifacts=None)
 
bool release (self, str run_id)
 

Public Attributes

 repo
 
 branch
 
 dir
 
 remote
 
 offline
 
 machine
 

Protected Member Functions

 _lock (self, timeout_s=300)
 
 _create_worktree (self)
 
 _publish_locked (self, run_id, summary, artifacts)
 
 _release_locked (self, run_id)
 
 _write_claim (self, rec)
 
 _head_sha (self)
 
 _commit (self, msg, paths)
 
bool _push (self)
 

Detailed Description

Git-backed claim board for one campaign branch.

Definition at line 112 of file gitsync.py.

Constructor & Destructor Documentation

◆ __init__()

gitsync.CampaignSync.__init__ (   self,
Path  repo_root,
str   branch = DEFAULT_BRANCH,
Path   sync_dir = SYNC_DIR,
str   remote = "origin",
bool   offline = False 
)

Definition at line 115 of file gitsync.py.

Member Function Documentation

◆ _commit()

gitsync.CampaignSync._commit (   self,
  msg,
  paths 
)
protected

Definition at line 361 of file gitsync.py.

◆ _create_worktree()

gitsync.CampaignSync._create_worktree (   self)
protected

Definition at line 163 of file gitsync.py.

◆ _head_sha()

gitsync.CampaignSync._head_sha (   self)
protected

Definition at line 357 of file gitsync.py.

◆ _lock()

gitsync.CampaignSync._lock (   self,
  timeout_s = 300 
)
protected

Definition at line 132 of file gitsync.py.

◆ _publish_locked()

gitsync.CampaignSync._publish_locked (   self,
  run_id,
  summary,
  artifacts 
)
protected

Definition at line 307 of file gitsync.py.

◆ _push()

bool gitsync.CampaignSync._push (   self)
protected

Definition at line 369 of file gitsync.py.

◆ _release_locked()

gitsync.CampaignSync._release_locked (   self,
  run_id 
)
protected

Definition at line 339 of file gitsync.py.

◆ _write_claim()

gitsync.CampaignSync._write_claim (   self,
  rec 
)
protected

Definition at line 350 of file gitsync.py.

◆ claim()

bool gitsync.CampaignSync.claim (   self,
str  run_id,
dict   meta = None 
)
Try to take `run_id`.  True if we own it, False if someone else does.

The remote decides.  We write the claim, commit and push; if the push is
rejected we refresh and look again -- if the run is now claimed by
another machine we lose it cleanly, and if it is still free we retry.

Definition at line 238 of file gitsync.py.

◆ claims()

dict gitsync.CampaignSync.claims (   self)
Every claim currently on the board, by run_id.

Definition at line 225 of file gitsync.py.

◆ ensure()

gitsync.CampaignSync.ensure (   self)
Create the worktree and branch if absent; make it current.

Definition at line 154 of file gitsync.py.

◆ next_unclaimed()

str | None gitsync.CampaignSync.next_unclaimed (   self,
list[str]  run_ids 
)

Definition at line 287 of file gitsync.py.

◆ publish()

bool gitsync.CampaignSync.publish (   self,
str  run_id,
dict  summary,
dict   artifacts = None 
)
Record a finished run and push it.  Called after EVERY run.

Definition at line 302 of file gitsync.py.

◆ refresh()

gitsync.CampaignSync.refresh (   self)
Bring the worktree to the remote's state, discarding nothing of ours.

Our own commits are preserved by rebasing them on top; the worktree
holds only campaign bookkeeping, so there is never local work here that
did not come from this module.

Definition at line 207 of file gitsync.py.

◆ release()

bool gitsync.CampaignSync.release (   self,
str  run_id 
)
Drop a claim so another machine can take the run.

Definition at line 334 of file gitsync.py.

Member Data Documentation

◆ branch

gitsync.CampaignSync.branch

Definition at line 119 of file gitsync.py.

◆ dir

gitsync.CampaignSync.dir

Definition at line 120 of file gitsync.py.

◆ machine

gitsync.CampaignSync.machine

Definition at line 123 of file gitsync.py.

◆ offline

gitsync.CampaignSync.offline

Definition at line 122 of file gitsync.py.

◆ remote

gitsync.CampaignSync.remote

Definition at line 121 of file gitsync.py.

◆ repo

gitsync.CampaignSync.repo

Definition at line 118 of file gitsync.py.


The documentation for this class was generated from the following file: