Miscellaneous
The following functions and classes are documented not as part of the core flow library, but for completeness/reference.
Functions
- flow.run_flow.run_flow(flow: Flow[RecordType]) None
Run a flow as a main script.
- Parameters:
flow (Flow) – The flow to run
When running the flow as a main program, the following flags are available:
Flow Arguments:
-d
,--dump
YAML_FILE
: Dump the configuration description to the specified file-r
,--run
YAML_FILE
: Run the flow with the configurations in the given file-v
,--validate
YAML_FILE
: Validate (but do not run) the flow with the configurations in the given file
Other Arguments:
-l
,--logfile
LOGFILE
: Add a path to log the flow’s output to-s
,--silent
: Prevent the flow from outputting to the command line-h
,--help
: Show the program’s usage and exit
- records.tag_record.get_tag_headers(labs: list[str]) list[str]
Create the headers for a TagRecords, based on its labs.
- Parameters:
labs (list[str]) – The labs that a TagRecords hold.
- Returns:
The corresponding spreadsheet headers that should be used to represent the TagRecords
- Return type:
list[str]
- github_steps.tag_repo.get_tagger(lab: str, repo_type: Literal['personal', 'group'], tag_records_type: Type[RecordType]) Type[FlowPropagateStep[RecordType]]
Return a propagate step that tags a specific lab.
- Parameters:
lab (str) – The lab to tag for.
repo_type (Literal['personal', 'group']) – The type of repo to tag
tag_records_type – The type of TagRagords to operate on
- Returns:
The generated class to tag the lab
- Return type:
Type[FlowPropagateStep[RecordType]]
For example, to add a tagger to a
Flow
namedtag-lab1.1
that tags all personal repos for thelab1.1
submission, one could do the following:flow.add_propagate_step( "tag-lab1.1", get_tagger("lab1.1", "personal", LabTagRecords) )
See
RepoTagger
for information on the generated/returned class type.
Classes
- flow.flow_steps.ValidConfigTypes
alias of
int
|bool
|str
|datetime
- class flow.flow_steps.FlowStep
A base class representing an abstract step in our flow.
- abstract class property description: str
A high-level description of the step
- abstract class property config_types: list[tuple[str, Type[ValidConfigTypes], str]]
The types of the configurations for the step. Each tuple in the list should include the name, type, and description of a configuration (respectively).
Based on the
config_types
, an instance of the class will have an attributeconfigs
with each described configuration. For example, ifconfig_types
is defined asconfig_types = [ ("test", int, "A test configuration") ]
then instances of the class will have an attribute
configs.test
of typeint
- abstractmethod validate() None
Validate the configurations for the step.
This function should inspect the object’s
configs
attribute, and perform any static validation possible.validate()
is always called on object initialization to ensure that configurations are always valid
- class records.tag_record.TagRecord(name: str | None = None, time: datetime | None = None, ref_sha: str | None = None, commit_sha: str | None = None)
A (possible) representation of a tag on a repository.
A TagRecord does not have to represent a current tag; it can also serve as a placeholder for a tag that hasn’t been created yet.
- - name
The name of the tag
- Type:
Optional[str]
- - time
The time the tag was created
- Type:
Optional[datetime]
- - ref_sha
The SHA-1 Hash of the Git Reference
- Type:
Optional[str]
- - commit_sha
The SHA-1 Hash of the commit that the tag references
- Type:
Optional[str]
- tagged() bool
Return whether the repo has already been tagged.
- Returns:
Whether the record represents an actual tag
- Return type:
bool