File

Defines the File_AT class.

class admit.at.File_AT.File_AT(**keyval)

Hold a file reference

See also File_AT for the design document, which admittedly still conflicts with what is written here.

The resulting File_BDP holds a reference to a file, useful for bootstrapping your flow if you don’t strictly need something complex such as Ingest_AT. Used primarily by the Flow*_AT family.

Keywords

file : string
The name of the file. See below for controlling parameters if the file needs to exist or if it can be created. File has to be a file within the admit project, absolute paths are not allowed. No default.
touch : bool
If True, the “touch” system command is used on the file, which will then either create a zero length file, or else update the timestamp of an existing file. Probably only useful for testing. Default: False
exist : bool
If True, the input file is checked for existence before it could even be touched. An exception is thrown if the file does not exist and should exist. Default: True
Parameters:

keyval : dictionary, optional

keyword-value pairs, directly passed to the contructor for ease of assignment

Attributes

_version (string) Version ID for some future TBD use. Also should not be documented here, as underscore attributes are for internal usage only. Maybe given an exception for history, and record this here 0.0.0: never published as such 1.0.0: for milestone 2

Methods

addinput(item[, slot]) Add a BDP input to an AT.
addinputbdp(item[, slot, insert]) Add a BDP to the _bdp_in list
addoutput(item[, slot]) Add a BDP output product to an AT.
addoutputbdp(item[, slot, insert]) Add a BDP to the _bdp_out list
check()
checkfiles() check if the files from all the BDP_out’s in an AT exist,
checktype(item) Check the type of an object to see if ti is a BDP
clearinput() Clear the input BDP list
clearoutput() Clear the output BDP list
copy() Creates an independent duplicate of the task.
delete([delfiles]) Method to delete the AT and underlying BDPs.
delinput(slot) Delete a specific BDP in the _bdp_in list
deloutput(slot) Delete a specific BDP in the _bdp_out list
dir([filename]) Return the absolution directory of this ADMIT project or a derefenced filename address.
execute([args]) Executes the task.
getVersion() Return the version string
getdtd(fl) Method to write out the dtd data
getkey(key) Retrieval value for a key.
haskey(key) Query if a key exists for an AT.
isequal(at) Method to determine if two ATs are the same.
isstale() Return True/False if an AT is up to date
len2() Return the length of _bdp_in and _bdp_out in a tuple
markChanged() Mark an AT that it’s state was changed, so it would need to be rerun.
markUpToDate() Sets the _stale state to indicate that the AT does not need to be run
mkdir(dirname) Make a directory in the ADMIT hierarchy if it doesn’t exist yet It also allows an absolute path, in the classical unix sense.
run() running the File_AT task
save()
set_bdp_in([bin]) Validate the _valid_bdp_in list and digest it into the appropriate attributes
set_bdp_out([bout]) Validate the _valid_bdp_out list and digest it into the appropriate attributes
setkey([name, value, isinit]) set keys, two styles are possible:
show() Return the type of the AT
summary() place holder empty summary in case the derived class doesn’t implement it
uptodate() Returns the current state of the _stale flag
validateinput([describe]) Method to validate the _bdp_in’s against a dictionary of expected types.
write(node) Method to write the AT to disk
run()

running the File_AT task

This Page