partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | DataStoreDocument.get | Return the field specified by its key from the specified section.
This method access the specified section of the workflow document and returns the
value for the given key.
Args:
key (str): The key pointing to the value that should be retrieved. It supports
MongoDB'... | lightflow/models/datastore.py | def get(self, key, default=None, *, section=DataStoreDocumentSection.Data):
""" Return the field specified by its key from the specified section.
This method access the specified section of the workflow document and returns the
value for the given key.
Args:
key (str): The ... | def get(self, key, default=None, *, section=DataStoreDocumentSection.Data):
""" Return the field specified by its key from the specified section.
This method access the specified section of the workflow document and returns the
value for the given key.
Args:
key (str): The ... | [
"Return",
"the",
"field",
"specified",
"by",
"its",
"key",
"from",
"the",
"specified",
"section",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/datastore.py#L248-L270 | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
",",
"*",
",",
"section",
"=",
"DataStoreDocumentSection",
".",
"Data",
")",
":",
"key_notation",
"=",
"'.'",
".",
"join",
"(",
"[",
"section",
",",
"key",
"]",
")",
"try",
":",
"r... | dc53dbc1d961e20fb144273baca258060705c03e |
train | DataStoreDocument.set | Store a value under the specified key in the given section of the document.
This method stores a value into the specified section of the workflow data store
document. Any existing value is overridden. Before storing a value, any linked
GridFS document under the specified key is deleted.
... | lightflow/models/datastore.py | def set(self, key, value, *, section=DataStoreDocumentSection.Data):
""" Store a value under the specified key in the given section of the document.
This method stores a value into the specified section of the workflow data store
document. Any existing value is overridden. Before storing a valu... | def set(self, key, value, *, section=DataStoreDocumentSection.Data):
""" Store a value under the specified key in the given section of the document.
This method stores a value into the specified section of the workflow data store
document. Any existing value is overridden. Before storing a valu... | [
"Store",
"a",
"value",
"under",
"the",
"specified",
"key",
"in",
"the",
"given",
"section",
"of",
"the",
"document",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/datastore.py#L272-L306 | [
"def",
"set",
"(",
"self",
",",
"key",
",",
"value",
",",
"*",
",",
"section",
"=",
"DataStoreDocumentSection",
".",
"Data",
")",
":",
"key_notation",
"=",
"'.'",
".",
"join",
"(",
"[",
"section",
",",
"key",
"]",
")",
"try",
":",
"self",
".",
"_de... | dc53dbc1d961e20fb144273baca258060705c03e |
train | DataStoreDocument.push | Appends a value to a list in the specified section of the document.
Args:
key (str): The key pointing to the value that should be stored/updated.
It supports MongoDB's dot notation for nested fields.
value: The value that should be appended to a list in the data store.
... | lightflow/models/datastore.py | def push(self, key, value, *, section=DataStoreDocumentSection.Data):
""" Appends a value to a list in the specified section of the document.
Args:
key (str): The key pointing to the value that should be stored/updated.
It supports MongoDB's dot notation for nested fields.
... | def push(self, key, value, *, section=DataStoreDocumentSection.Data):
""" Appends a value to a list in the specified section of the document.
Args:
key (str): The key pointing to the value that should be stored/updated.
It supports MongoDB's dot notation for nested fields.
... | [
"Appends",
"a",
"value",
"to",
"a",
"list",
"in",
"the",
"specified",
"section",
"of",
"the",
"document",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/datastore.py#L308-L331 | [
"def",
"push",
"(",
"self",
",",
"key",
",",
"value",
",",
"*",
",",
"section",
"=",
"DataStoreDocumentSection",
".",
"Data",
")",
":",
"key_notation",
"=",
"'.'",
".",
"join",
"(",
"[",
"section",
",",
"key",
"]",
")",
"result",
"=",
"self",
".",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | DataStoreDocument.extend | Extends a list in the data store with the elements of values.
Args:
key (str): The key pointing to the value that should be stored/updated.
It supports MongoDB's dot notation for nested fields.
values (list): A list of the values that should be used to extend the list
... | lightflow/models/datastore.py | def extend(self, key, values, *, section=DataStoreDocumentSection.Data):
""" Extends a list in the data store with the elements of values.
Args:
key (str): The key pointing to the value that should be stored/updated.
It supports MongoDB's dot notation for nested fields.
... | def extend(self, key, values, *, section=DataStoreDocumentSection.Data):
""" Extends a list in the data store with the elements of values.
Args:
key (str): The key pointing to the value that should be stored/updated.
It supports MongoDB's dot notation for nested fields.
... | [
"Extends",
"a",
"list",
"in",
"the",
"data",
"store",
"with",
"the",
"elements",
"of",
"values",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/datastore.py#L333-L361 | [
"def",
"extend",
"(",
"self",
",",
"key",
",",
"values",
",",
"*",
",",
"section",
"=",
"DataStoreDocumentSection",
".",
"Data",
")",
":",
"key_notation",
"=",
"'.'",
".",
"join",
"(",
"[",
"section",
",",
"key",
"]",
")",
"if",
"not",
"isinstance",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | DataStoreDocument._data_from_dotnotation | Returns the MongoDB data from a key using dot notation.
Args:
key (str): The key to the field in the workflow document. Supports MongoDB's
dot notation for embedded fields.
default (object): The default value that is returned if the key
does not exist.
... | lightflow/models/datastore.py | def _data_from_dotnotation(self, key, default=None):
""" Returns the MongoDB data from a key using dot notation.
Args:
key (str): The key to the field in the workflow document. Supports MongoDB's
dot notation for embedded fields.
default (object): The default val... | def _data_from_dotnotation(self, key, default=None):
""" Returns the MongoDB data from a key using dot notation.
Args:
key (str): The key to the field in the workflow document. Supports MongoDB's
dot notation for embedded fields.
default (object): The default val... | [
"Returns",
"the",
"MongoDB",
"data",
"from",
"a",
"key",
"using",
"dot",
"notation",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/datastore.py#L363-L385 | [
"def",
"_data_from_dotnotation",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"if",
"key",
"is",
"None",
":",
"raise",
"KeyError",
"(",
"'NoneType is not a valid key!'",
")",
"doc",
"=",
"self",
".",
"_collection",
".",
"find_one",
"(",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | DataStoreDocument._encode_value | Encodes the value such that it can be stored into MongoDB.
Any primitive types are stored directly into MongoDB, while non-primitive types
are pickled and stored as GridFS objects. The id pointing to a GridFS object
replaces the original value.
Args:
value (object): The obj... | lightflow/models/datastore.py | def _encode_value(self, value):
""" Encodes the value such that it can be stored into MongoDB.
Any primitive types are stored directly into MongoDB, while non-primitive types
are pickled and stored as GridFS objects. The id pointing to a GridFS object
replaces the original value.
... | def _encode_value(self, value):
""" Encodes the value such that it can be stored into MongoDB.
Any primitive types are stored directly into MongoDB, while non-primitive types
are pickled and stored as GridFS objects. The id pointing to a GridFS object
replaces the original value.
... | [
"Encodes",
"the",
"value",
"such",
"that",
"it",
"can",
"be",
"stored",
"into",
"MongoDB",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/datastore.py#L387-L411 | [
"def",
"_encode_value",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"int",
",",
"float",
",",
"str",
",",
"bool",
",",
"datetime",
")",
")",
":",
"return",
"value",
"elif",
"isinstance",
"(",
"value",
",",
"list",... | dc53dbc1d961e20fb144273baca258060705c03e |
train | DataStoreDocument._decode_value | Decodes the value by turning any binary data back into Python objects.
The method searches for ObjectId values, loads the associated binary data from
GridFS and returns the decoded Python object.
Args:
value (object): The value that should be decoded.
Raises:
D... | lightflow/models/datastore.py | def _decode_value(self, value):
""" Decodes the value by turning any binary data back into Python objects.
The method searches for ObjectId values, loads the associated binary data from
GridFS and returns the decoded Python object.
Args:
value (object): The value that shoul... | def _decode_value(self, value):
""" Decodes the value by turning any binary data back into Python objects.
The method searches for ObjectId values, loads the associated binary data from
GridFS and returns the decoded Python object.
Args:
value (object): The value that shoul... | [
"Decodes",
"the",
"value",
"by",
"turning",
"any",
"binary",
"data",
"back",
"into",
"Python",
"objects",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/datastore.py#L413-L445 | [
"def",
"_decode_value",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"int",
",",
"float",
",",
"str",
",",
"bool",
",",
"datetime",
")",
")",
":",
"return",
"value",
"elif",
"isinstance",
"(",
"value",
",",
"list",... | dc53dbc1d961e20fb144273baca258060705c03e |
train | DataStoreDocument._delete_gridfs_data | Delete all GridFS data that is linked by fields in the specified data.
Args:
data: The data that is parsed for MongoDB ObjectIDs. The linked GridFs object
for any ObjectID is deleted. | lightflow/models/datastore.py | def _delete_gridfs_data(self, data):
""" Delete all GridFS data that is linked by fields in the specified data.
Args:
data: The data that is parsed for MongoDB ObjectIDs. The linked GridFs object
for any ObjectID is deleted.
"""
if isinstance(data, ObjectId):... | def _delete_gridfs_data(self, data):
""" Delete all GridFS data that is linked by fields in the specified data.
Args:
data: The data that is parsed for MongoDB ObjectIDs. The linked GridFs object
for any ObjectID is deleted.
"""
if isinstance(data, ObjectId):... | [
"Delete",
"all",
"GridFS",
"data",
"that",
"is",
"linked",
"by",
"fields",
"in",
"the",
"specified",
"data",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/datastore.py#L447-L464 | [
"def",
"_delete_gridfs_data",
"(",
"self",
",",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"ObjectId",
")",
":",
"if",
"self",
".",
"_gridfs",
".",
"exists",
"(",
"{",
"\"_id\"",
":",
"data",
"}",
")",
":",
"self",
".",
"_gridfs",
".",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Callinfo.get_homecall | Strips off country prefixes (HC2/DH1TW) and activity suffixes (DH1TW/P).
Args:
callsign (str): Amateur Radio callsign
Returns:
str: callsign without country/activity pre/suffixes
Raises:
ValueError: No callsign found in string
Example:
... | pyhamtools/callinfo.py | def get_homecall(callsign):
"""Strips off country prefixes (HC2/DH1TW) and activity suffixes (DH1TW/P).
Args:
callsign (str): Amateur Radio callsign
Returns:
str: callsign without country/activity pre/suffixes
Raises:
ValueError: No callsign found i... | def get_homecall(callsign):
"""Strips off country prefixes (HC2/DH1TW) and activity suffixes (DH1TW/P).
Args:
callsign (str): Amateur Radio callsign
Returns:
str: callsign without country/activity pre/suffixes
Raises:
ValueError: No callsign found i... | [
"Strips",
"off",
"country",
"prefixes",
"(",
"HC2",
"/",
"DH1TW",
")",
"and",
"activity",
"suffixes",
"(",
"DH1TW",
"/",
"P",
")",
"."
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L50-L79 | [
"def",
"get_homecall",
"(",
"callsign",
")",
":",
"callsign",
"=",
"callsign",
".",
"upper",
"(",
")",
"homecall",
"=",
"re",
".",
"search",
"(",
"'[\\d]{0,1}[A-Z]{1,2}\\d([A-Z]{1,4}|\\d{3,3}|\\d{1,3}[A-Z])[A-Z]{0,5}'",
",",
"callsign",
")",
"if",
"homecall",
":",
... | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | Callinfo._iterate_prefix | truncate call until it corresponds to a Prefix in the database | pyhamtools/callinfo.py | def _iterate_prefix(self, callsign, timestamp=timestamp_now):
"""truncate call until it corresponds to a Prefix in the database"""
prefix = callsign
if re.search('(VK|AX|VI)9[A-Z]{3}', callsign): #special rule for VK9 calls
if timestamp > datetime(2006,1,1, tzinfo=UTC):
... | def _iterate_prefix(self, callsign, timestamp=timestamp_now):
"""truncate call until it corresponds to a Prefix in the database"""
prefix = callsign
if re.search('(VK|AX|VI)9[A-Z]{3}', callsign): #special rule for VK9 calls
if timestamp > datetime(2006,1,1, tzinfo=UTC):
... | [
"truncate",
"call",
"until",
"it",
"corresponds",
"to",
"a",
"Prefix",
"in",
"the",
"database"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L81-L95 | [
"def",
"_iterate_prefix",
"(",
"self",
",",
"callsign",
",",
"timestamp",
"=",
"timestamp_now",
")",
":",
"prefix",
"=",
"callsign",
"if",
"re",
".",
"search",
"(",
"'(VK|AX|VI)9[A-Z]{3}'",
",",
"callsign",
")",
":",
"#special rule for VK9 calls",
"if",
"timesta... | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | Callinfo._dismantle_callsign | try to identify the callsign's identity by analyzing it in the following order:
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Raises:
KeyError: Callsign could not be identified | pyhamtools/callinfo.py | def _dismantle_callsign(self, callsign, timestamp=timestamp_now):
""" try to identify the callsign's identity by analyzing it in the following order:
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Raises:
... | def _dismantle_callsign(self, callsign, timestamp=timestamp_now):
""" try to identify the callsign's identity by analyzing it in the following order:
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Raises:
... | [
"try",
"to",
"identify",
"the",
"callsign",
"s",
"identity",
"by",
"analyzing",
"it",
"in",
"the",
"following",
"order",
":"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L112-L222 | [
"def",
"_dismantle_callsign",
"(",
"self",
",",
"callsign",
",",
"timestamp",
"=",
"timestamp_now",
")",
":",
"entire_callsign",
"=",
"callsign",
".",
"upper",
"(",
")",
"if",
"re",
".",
"search",
"(",
"'[/A-Z0-9\\-]{3,15}'",
",",
"entire_callsign",
")",
":",
... | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | Callinfo.get_all | Lookup a callsign and return all data available from the underlying database
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
dict: Dictionary containing the callsign specific data
Raise... | pyhamtools/callinfo.py | def get_all(self, callsign, timestamp=timestamp_now):
""" Lookup a callsign and return all data available from the underlying database
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
dic... | def get_all(self, callsign, timestamp=timestamp_now):
""" Lookup a callsign and return all data available from the underlying database
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
dic... | [
"Lookup",
"a",
"callsign",
"and",
"return",
"all",
"data",
"available",
"from",
"the",
"underlying",
"database"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L267-L313 | [
"def",
"get_all",
"(",
"self",
",",
"callsign",
",",
"timestamp",
"=",
"timestamp_now",
")",
":",
"callsign_data",
"=",
"self",
".",
"_lookup_callsign",
"(",
"callsign",
",",
"timestamp",
")",
"try",
":",
"cqz",
"=",
"self",
".",
"_lookuplib",
".",
"lookup... | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | Callinfo.is_valid_callsign | Checks if a callsign is valid
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
bool: True / False
Example:
The following checks if "DH1TW" is a valid callsign
>>... | pyhamtools/callinfo.py | def is_valid_callsign(self, callsign, timestamp=timestamp_now):
""" Checks if a callsign is valid
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
bool: True / False
Example:
... | def is_valid_callsign(self, callsign, timestamp=timestamp_now):
""" Checks if a callsign is valid
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
bool: True / False
Example:
... | [
"Checks",
"if",
"a",
"callsign",
"is",
"valid"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L315-L339 | [
"def",
"is_valid_callsign",
"(",
"self",
",",
"callsign",
",",
"timestamp",
"=",
"timestamp_now",
")",
":",
"try",
":",
"if",
"self",
".",
"get_all",
"(",
"callsign",
",",
"timestamp",
")",
":",
"return",
"True",
"except",
"KeyError",
":",
"return",
"False... | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | Callinfo.get_lat_long | Returns Latitude and Longitude for a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
dict: Containing Latitude and Longitude
Raises:
KeyError: No data found for cal... | pyhamtools/callinfo.py | def get_lat_long(self, callsign, timestamp=timestamp_now):
""" Returns Latitude and Longitude for a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
dict: Containing Latitude and... | def get_lat_long(self, callsign, timestamp=timestamp_now):
""" Returns Latitude and Longitude for a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
dict: Containing Latitude and... | [
"Returns",
"Latitude",
"and",
"Longitude",
"for",
"a",
"callsign"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L341-L376 | [
"def",
"get_lat_long",
"(",
"self",
",",
"callsign",
",",
"timestamp",
"=",
"timestamp_now",
")",
":",
"callsign_data",
"=",
"self",
".",
"get_all",
"(",
"callsign",
",",
"timestamp",
"=",
"timestamp",
")",
"return",
"{",
"const",
".",
"LATITUDE",
":",
"ca... | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | Callinfo.get_cqz | Returns CQ Zone of a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
int: containing the callsign's CQ Zone
Raises:
KeyError: no CQ Zone found for callsign | pyhamtools/callinfo.py | def get_cqz(self, callsign, timestamp=timestamp_now):
""" Returns CQ Zone of a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
int: containing the callsign's CQ Zone
Ra... | def get_cqz(self, callsign, timestamp=timestamp_now):
""" Returns CQ Zone of a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
int: containing the callsign's CQ Zone
Ra... | [
"Returns",
"CQ",
"Zone",
"of",
"a",
"callsign"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L378-L392 | [
"def",
"get_cqz",
"(",
"self",
",",
"callsign",
",",
"timestamp",
"=",
"timestamp_now",
")",
":",
"return",
"self",
".",
"get_all",
"(",
"callsign",
",",
"timestamp",
")",
"[",
"const",
".",
"CQZ",
"]"
] | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | Callinfo.get_ituz | Returns ITU Zone of a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
int: containing the callsign's CQ Zone
Raises:
KeyError: No ITU Zone found for callsign
... | pyhamtools/callinfo.py | def get_ituz(self, callsign, timestamp=timestamp_now):
""" Returns ITU Zone of a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
int: containing the callsign's CQ Zone
... | def get_ituz(self, callsign, timestamp=timestamp_now):
""" Returns ITU Zone of a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
int: containing the callsign's CQ Zone
... | [
"Returns",
"ITU",
"Zone",
"of",
"a",
"callsign"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L394-L411 | [
"def",
"get_ituz",
"(",
"self",
",",
"callsign",
",",
"timestamp",
"=",
"timestamp_now",
")",
":",
"return",
"self",
".",
"get_all",
"(",
"callsign",
",",
"timestamp",
")",
"[",
"const",
".",
"ITUZ",
"]"
] | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | Callinfo.get_country_name | Returns the country name where the callsign is located
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
str: name of the Country
Raises:
KeyError: No Country found for callsi... | pyhamtools/callinfo.py | def get_country_name(self, callsign, timestamp=timestamp_now):
""" Returns the country name where the callsign is located
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
str: name of the... | def get_country_name(self, callsign, timestamp=timestamp_now):
""" Returns the country name where the callsign is located
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
str: name of the... | [
"Returns",
"the",
"country",
"name",
"where",
"the",
"callsign",
"is",
"located"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L413-L435 | [
"def",
"get_country_name",
"(",
"self",
",",
"callsign",
",",
"timestamp",
"=",
"timestamp_now",
")",
":",
"return",
"self",
".",
"get_all",
"(",
"callsign",
",",
"timestamp",
")",
"[",
"const",
".",
"COUNTRY",
"]"
] | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | Callinfo.get_adif_id | Returns ADIF id of a callsign's country
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
int: containing the country ADIF id
Raises:
KeyError: No Country found for callsign | pyhamtools/callinfo.py | def get_adif_id(self, callsign, timestamp=timestamp_now):
""" Returns ADIF id of a callsign's country
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
int: containing the country ADIF id
... | def get_adif_id(self, callsign, timestamp=timestamp_now):
""" Returns ADIF id of a callsign's country
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
int: containing the country ADIF id
... | [
"Returns",
"ADIF",
"id",
"of",
"a",
"callsign",
"s",
"country"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L437-L451 | [
"def",
"get_adif_id",
"(",
"self",
",",
"callsign",
",",
"timestamp",
"=",
"timestamp_now",
")",
":",
"return",
"self",
".",
"get_all",
"(",
"callsign",
",",
"timestamp",
")",
"[",
"const",
".",
"ADIF",
"]"
] | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | Callinfo.get_continent | Returns the continent Identifier of a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
str: continent identified
Raises:
KeyError: No Continent found for callsign
... | pyhamtools/callinfo.py | def get_continent(self, callsign, timestamp=timestamp_now):
""" Returns the continent Identifier of a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
str: continent identified
... | def get_continent(self, callsign, timestamp=timestamp_now):
""" Returns the continent Identifier of a callsign
Args:
callsign (str): Amateur Radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)
Returns:
str: continent identified
... | [
"Returns",
"the",
"continent",
"Identifier",
"of",
"a",
"callsign"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/callinfo.py#L453-L477 | [
"def",
"get_continent",
"(",
"self",
",",
"callsign",
",",
"timestamp",
"=",
"timestamp_now",
")",
":",
"return",
"self",
".",
"get_all",
"(",
"callsign",
",",
"timestamp",
")",
"[",
"const",
".",
"CONTINENT",
"]"
] | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | find_indices | Returns the indices for all occurrences of 'element' in 'lst'.
Args:
lst (list): List to search.
element: Element to find.
Returns:
list: List of indices or values | lightflow/models/utils.py | def find_indices(lst, element):
""" Returns the indices for all occurrences of 'element' in 'lst'.
Args:
lst (list): List to search.
element: Element to find.
Returns:
list: List of indices or values
"""
result = []
offset = -1
while True:
try:
... | def find_indices(lst, element):
""" Returns the indices for all occurrences of 'element' in 'lst'.
Args:
lst (list): List to search.
element: Element to find.
Returns:
list: List of indices or values
"""
result = []
offset = -1
while True:
try:
... | [
"Returns",
"the",
"indices",
"for",
"all",
"occurrences",
"of",
"element",
"in",
"lst",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/utils.py#L2-L19 | [
"def",
"find_indices",
"(",
"lst",
",",
"element",
")",
":",
"result",
"=",
"[",
"]",
"offset",
"=",
"-",
"1",
"while",
"True",
":",
"try",
":",
"offset",
"=",
"lst",
".",
"index",
"(",
"element",
",",
"offset",
"+",
"1",
")",
"except",
"ValueError... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Workflow.from_name | Create a workflow object from a workflow script.
Args:
name (str): The name of the workflow script.
queue (str): Name of the queue the workflow should be scheduled to.
clear_data_store (bool): Remove any documents created during the workflow
... | lightflow/models/workflow.py | def from_name(cls, name, *, queue=DefaultJobQueueName.Workflow,
clear_data_store=True, arguments=None):
""" Create a workflow object from a workflow script.
Args:
name (str): The name of the workflow script.
queue (str): Name of the queue the workflow should be... | def from_name(cls, name, *, queue=DefaultJobQueueName.Workflow,
clear_data_store=True, arguments=None):
""" Create a workflow object from a workflow script.
Args:
name (str): The name of the workflow script.
queue (str): Name of the queue the workflow should be... | [
"Create",
"a",
"workflow",
"object",
"from",
"a",
"workflow",
"script",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/workflow.py#L59-L76 | [
"def",
"from_name",
"(",
"cls",
",",
"name",
",",
"*",
",",
"queue",
"=",
"DefaultJobQueueName",
".",
"Workflow",
",",
"clear_data_store",
"=",
"True",
",",
"arguments",
"=",
"None",
")",
":",
"new_workflow",
"=",
"cls",
"(",
"queue",
"=",
"queue",
",",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Workflow.load | Import the workflow script and load all known objects.
The workflow script is treated like a module and imported
into the Python namespace. After the import, the method looks
for instances of known classes and stores a reference for further
use in the workflow object.
Args:
... | lightflow/models/workflow.py | def load(self, name, *, arguments=None, validate_arguments=True, strict_dag=False):
""" Import the workflow script and load all known objects.
The workflow script is treated like a module and imported
into the Python namespace. After the import, the method looks
for instances of known c... | def load(self, name, *, arguments=None, validate_arguments=True, strict_dag=False):
""" Import the workflow script and load all known objects.
The workflow script is treated like a module and imported
into the Python namespace. After the import, the method looks
for instances of known c... | [
"Import",
"the",
"workflow",
"script",
"and",
"load",
"all",
"known",
"objects",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/workflow.py#L108-L165 | [
"def",
"load",
"(",
"self",
",",
"name",
",",
"*",
",",
"arguments",
"=",
"None",
",",
"validate_arguments",
"=",
"True",
",",
"strict_dag",
"=",
"False",
")",
":",
"arguments",
"=",
"{",
"}",
"if",
"arguments",
"is",
"None",
"else",
"arguments",
"try"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Workflow.run | Run all autostart dags in the workflow.
Only the dags that are flagged as autostart are started.
Args:
config (Config): Reference to the configuration object from which the
settings for the workflow are retrieved.
data_store (DataStore): A DataStore... | lightflow/models/workflow.py | def run(self, config, data_store, signal_server, workflow_id):
""" Run all autostart dags in the workflow.
Only the dags that are flagged as autostart are started.
Args:
config (Config): Reference to the configuration object from which the
settings for ... | def run(self, config, data_store, signal_server, workflow_id):
""" Run all autostart dags in the workflow.
Only the dags that are flagged as autostart are started.
Args:
config (Config): Reference to the configuration object from which the
settings for ... | [
"Run",
"all",
"autostart",
"dags",
"in",
"the",
"workflow",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/workflow.py#L167-L228 | [
"def",
"run",
"(",
"self",
",",
"config",
",",
"data_store",
",",
"signal_server",
",",
"workflow_id",
")",
":",
"self",
".",
"_workflow_id",
"=",
"workflow_id",
"self",
".",
"_celery_app",
"=",
"create_app",
"(",
"config",
")",
"# pre-fill the data store with s... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Workflow._queue_dag | Add a new dag to the queue.
If the stop workflow flag is set, no new dag can be queued.
Args:
name (str): The name of the dag that should be queued.
data (MultiTaskData): The data that should be passed on to the new dag.
Raises:
DagNameUnknown: If the speci... | lightflow/models/workflow.py | def _queue_dag(self, name, *, data=None):
""" Add a new dag to the queue.
If the stop workflow flag is set, no new dag can be queued.
Args:
name (str): The name of the dag that should be queued.
data (MultiTaskData): The data that should be passed on to the new dag.
... | def _queue_dag(self, name, *, data=None):
""" Add a new dag to the queue.
If the stop workflow flag is set, no new dag can be queued.
Args:
name (str): The name of the dag that should be queued.
data (MultiTaskData): The data that should be passed on to the new dag.
... | [
"Add",
"a",
"new",
"dag",
"to",
"the",
"queue",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/workflow.py#L230-L257 | [
"def",
"_queue_dag",
"(",
"self",
",",
"name",
",",
"*",
",",
"data",
"=",
"None",
")",
":",
"if",
"self",
".",
"_stop_workflow",
":",
"return",
"None",
"if",
"name",
"not",
"in",
"self",
".",
"_dags_blueprint",
":",
"raise",
"DagNameUnknown",
"(",
")"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Workflow._handle_request | Handle an incoming request by forwarding it to the appropriate method.
Args:
request (Request): Reference to a request object containing the
incoming request.
Raises:
RequestActionUnknown: If the action specified in the request is not known.
... | lightflow/models/workflow.py | def _handle_request(self, request):
""" Handle an incoming request by forwarding it to the appropriate method.
Args:
request (Request): Reference to a request object containing the
incoming request.
Raises:
RequestActionUnknown: If the act... | def _handle_request(self, request):
""" Handle an incoming request by forwarding it to the appropriate method.
Args:
request (Request): Reference to a request object containing the
incoming request.
Raises:
RequestActionUnknown: If the act... | [
"Handle",
"an",
"incoming",
"request",
"by",
"forwarding",
"it",
"to",
"the",
"appropriate",
"method",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/workflow.py#L259-L287 | [
"def",
"_handle_request",
"(",
"self",
",",
"request",
")",
":",
"if",
"request",
"is",
"None",
":",
"return",
"Response",
"(",
"success",
"=",
"False",
",",
"uid",
"=",
"request",
".",
"uid",
")",
"action_map",
"=",
"{",
"'start_dag'",
":",
"self",
".... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Workflow._handle_start_dag | The handler for the start_dag request.
The start_dag request creates a new dag and adds it to the queue.
Args:
request (Request): Reference to a request object containing the
incoming request. The payload has to contain the
foll... | lightflow/models/workflow.py | def _handle_start_dag(self, request):
""" The handler for the start_dag request.
The start_dag request creates a new dag and adds it to the queue.
Args:
request (Request): Reference to a request object containing the
incoming request. The payload has ... | def _handle_start_dag(self, request):
""" The handler for the start_dag request.
The start_dag request creates a new dag and adds it to the queue.
Args:
request (Request): Reference to a request object containing the
incoming request. The payload has ... | [
"The",
"handler",
"for",
"the",
"start_dag",
"request",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/workflow.py#L289-L308 | [
"def",
"_handle_start_dag",
"(",
"self",
",",
"request",
")",
":",
"dag_name",
"=",
"self",
".",
"_queue_dag",
"(",
"name",
"=",
"request",
".",
"payload",
"[",
"'name'",
"]",
",",
"data",
"=",
"request",
".",
"payload",
"[",
"'data'",
"]",
")",
"retur... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Workflow._handle_stop_workflow | The handler for the stop_workflow request.
The stop_workflow request adds all running dags to the list of dags
that should be stopped and prevents new dags from being started. The dags will
then stop queueing new tasks, which will terminate the dags and in turn the
workflow.
Ar... | lightflow/models/workflow.py | def _handle_stop_workflow(self, request):
""" The handler for the stop_workflow request.
The stop_workflow request adds all running dags to the list of dags
that should be stopped and prevents new dags from being started. The dags will
then stop queueing new tasks, which will terminate ... | def _handle_stop_workflow(self, request):
""" The handler for the stop_workflow request.
The stop_workflow request adds all running dags to the list of dags
that should be stopped and prevents new dags from being started. The dags will
then stop queueing new tasks, which will terminate ... | [
"The",
"handler",
"for",
"the",
"stop_workflow",
"request",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/workflow.py#L310-L331 | [
"def",
"_handle_stop_workflow",
"(",
"self",
",",
"request",
")",
":",
"self",
".",
"_stop_workflow",
"=",
"True",
"for",
"name",
",",
"dag",
"in",
"self",
".",
"_dags_running",
".",
"items",
"(",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"_sto... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Workflow._handle_join_dags | The handler for the join_dags request.
If dag names are given in the payload only return a valid Response if none of
the dags specified by the names are running anymore. If no dag names are given,
wait for all dags except one, which by design is the one that issued the request,
to be fi... | lightflow/models/workflow.py | def _handle_join_dags(self, request):
""" The handler for the join_dags request.
If dag names are given in the payload only return a valid Response if none of
the dags specified by the names are running anymore. If no dag names are given,
wait for all dags except one, which by design is... | def _handle_join_dags(self, request):
""" The handler for the join_dags request.
If dag names are given in the payload only return a valid Response if none of
the dags specified by the names are running anymore. If no dag names are given,
wait for all dags except one, which by design is... | [
"The",
"handler",
"for",
"the",
"join_dags",
"request",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/workflow.py#L333-L359 | [
"def",
"_handle_join_dags",
"(",
"self",
",",
"request",
")",
":",
"if",
"request",
".",
"payload",
"[",
"'names'",
"]",
"is",
"None",
":",
"send_response",
"=",
"len",
"(",
"self",
".",
"_dags_running",
")",
"<=",
"1",
"else",
":",
"send_response",
"=",... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Workflow._handle_stop_dag | The handler for the stop_dag request.
The stop_dag request adds a dag to the list of dags that should be stopped.
The dag will then stop queueing new tasks and will eventually stop running.
Args:
request (Request): Reference to a request object containing the
... | lightflow/models/workflow.py | def _handle_stop_dag(self, request):
""" The handler for the stop_dag request.
The stop_dag request adds a dag to the list of dags that should be stopped.
The dag will then stop queueing new tasks and will eventually stop running.
Args:
request (Request): Reference to a req... | def _handle_stop_dag(self, request):
""" The handler for the stop_dag request.
The stop_dag request adds a dag to the list of dags that should be stopped.
The dag will then stop queueing new tasks and will eventually stop running.
Args:
request (Request): Reference to a req... | [
"The",
"handler",
"for",
"the",
"stop_dag",
"request",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/workflow.py#L361-L381 | [
"def",
"_handle_stop_dag",
"(",
"self",
",",
"request",
")",
":",
"if",
"(",
"request",
".",
"payload",
"[",
"'name'",
"]",
"is",
"not",
"None",
")",
"and",
"(",
"request",
".",
"payload",
"[",
"'name'",
"]",
"not",
"in",
"self",
".",
"_stop_dags",
"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Workflow._handle_is_dag_stopped | The handler for the dag_stopped request.
The dag_stopped request checks whether a dag is flagged to be terminated.
Args:
request (Request): Reference to a request object containing the
incoming request. The payload has to contain the
... | lightflow/models/workflow.py | def _handle_is_dag_stopped(self, request):
""" The handler for the dag_stopped request.
The dag_stopped request checks whether a dag is flagged to be terminated.
Args:
request (Request): Reference to a request object containing the
incoming request. T... | def _handle_is_dag_stopped(self, request):
""" The handler for the dag_stopped request.
The dag_stopped request checks whether a dag is flagged to be terminated.
Args:
request (Request): Reference to a request object containing the
incoming request. T... | [
"The",
"handler",
"for",
"the",
"dag_stopped",
"request",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/workflow.py#L383-L402 | [
"def",
"_handle_is_dag_stopped",
"(",
"self",
",",
"request",
")",
":",
"return",
"Response",
"(",
"success",
"=",
"True",
",",
"uid",
"=",
"request",
".",
"uid",
",",
"payload",
"=",
"{",
"'is_stopped'",
":",
"request",
".",
"payload",
"[",
"'dag_name'",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | WorkerLifecycle.stop | This function is called when the worker received a request to terminate.
Upon the termination of the worker, the workflows for all running jobs are
stopped gracefully.
Args:
consumer (Consumer): Reference to the consumer object that handles messages
... | lightflow/queue/worker.py | def stop(self, consumer):
""" This function is called when the worker received a request to terminate.
Upon the termination of the worker, the workflows for all running jobs are
stopped gracefully.
Args:
consumer (Consumer): Reference to the consumer object that handles mes... | def stop(self, consumer):
""" This function is called when the worker received a request to terminate.
Upon the termination of the worker, the workflows for all running jobs are
stopped gracefully.
Args:
consumer (Consumer): Reference to the consumer object that handles mes... | [
"This",
"function",
"is",
"called",
"when",
"the",
"worker",
"received",
"a",
"request",
"to",
"terminate",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/worker.py#L10-L32 | [
"def",
"stop",
"(",
"self",
",",
"consumer",
")",
":",
"stopped_workflows",
"=",
"[",
"]",
"for",
"request",
"in",
"[",
"r",
"for",
"r",
"in",
"consumer",
".",
"controller",
".",
"state",
".",
"active_requests",
"]",
":",
"job",
"=",
"AsyncResult",
"("... | dc53dbc1d961e20fb144273baca258060705c03e |
train | TaskSignal.start_dag | Schedule the execution of a dag by sending a signal to the workflow.
Args:
dag (Dag, str): The dag object or the name of the dag that should be started.
data (MultiTaskData): The data that should be passed on to the new dag.
Returns:
str: The name of the successfull... | lightflow/models/task_signal.py | def start_dag(self, dag, *, data=None):
""" Schedule the execution of a dag by sending a signal to the workflow.
Args:
dag (Dag, str): The dag object or the name of the dag that should be started.
data (MultiTaskData): The data that should be passed on to the new dag.
R... | def start_dag(self, dag, *, data=None):
""" Schedule the execution of a dag by sending a signal to the workflow.
Args:
dag (Dag, str): The dag object or the name of the dag that should be started.
data (MultiTaskData): The data that should be passed on to the new dag.
R... | [
"Schedule",
"the",
"execution",
"of",
"a",
"dag",
"by",
"sending",
"a",
"signal",
"to",
"the",
"workflow",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_signal.py#L18-L34 | [
"def",
"start_dag",
"(",
"self",
",",
"dag",
",",
"*",
",",
"data",
"=",
"None",
")",
":",
"return",
"self",
".",
"_client",
".",
"send",
"(",
"Request",
"(",
"action",
"=",
"'start_dag'",
",",
"payload",
"=",
"{",
"'name'",
":",
"dag",
".",
"name"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | TaskSignal.join_dags | Wait for the specified dags to terminate.
This function blocks until the specified dags terminate. If no dags are specified
wait for all dags of the workflow, except the dag of the task calling this signal,
to terminate.
Args:
names (list): The names of the dags that have t... | lightflow/models/task_signal.py | def join_dags(self, names=None):
""" Wait for the specified dags to terminate.
This function blocks until the specified dags terminate. If no dags are specified
wait for all dags of the workflow, except the dag of the task calling this signal,
to terminate.
Args:
na... | def join_dags(self, names=None):
""" Wait for the specified dags to terminate.
This function blocks until the specified dags terminate. If no dags are specified
wait for all dags of the workflow, except the dag of the task calling this signal,
to terminate.
Args:
na... | [
"Wait",
"for",
"the",
"specified",
"dags",
"to",
"terminate",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_signal.py#L36-L54 | [
"def",
"join_dags",
"(",
"self",
",",
"names",
"=",
"None",
")",
":",
"return",
"self",
".",
"_client",
".",
"send",
"(",
"Request",
"(",
"action",
"=",
"'join_dags'",
",",
"payload",
"=",
"{",
"'names'",
":",
"names",
"}",
")",
")",
".",
"success"
] | dc53dbc1d961e20fb144273baca258060705c03e |
train | TaskSignal.stop_dag | Send a stop signal to the specified dag or the dag that hosts this task.
Args:
name str: The name of the dag that should be stopped. If no name is given the
dag that hosts this task is stopped.
Upon receiving the stop signal, the dag will not queue any new tasks and w... | lightflow/models/task_signal.py | def stop_dag(self, name=None):
""" Send a stop signal to the specified dag or the dag that hosts this task.
Args:
name str: The name of the dag that should be stopped. If no name is given the
dag that hosts this task is stopped.
Upon receiving the stop signal,... | def stop_dag(self, name=None):
""" Send a stop signal to the specified dag or the dag that hosts this task.
Args:
name str: The name of the dag that should be stopped. If no name is given the
dag that hosts this task is stopped.
Upon receiving the stop signal,... | [
"Send",
"a",
"stop",
"signal",
"to",
"the",
"specified",
"dag",
"or",
"the",
"dag",
"that",
"hosts",
"this",
"task",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_signal.py#L56-L74 | [
"def",
"stop_dag",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"return",
"self",
".",
"_client",
".",
"send",
"(",
"Request",
"(",
"action",
"=",
"'stop_dag'",
",",
"payload",
"=",
"{",
"'name'",
":",
"name",
"if",
"name",
"is",
"not",
"None",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | TaskSignal.is_stopped | Check whether the task received a stop signal from the workflow.
Tasks can use the stop flag to gracefully terminate their work. This is
particularly important for long running tasks and tasks that employ an
infinite loop, such as trigger tasks.
Returns:
bool: True if the t... | lightflow/models/task_signal.py | def is_stopped(self):
""" Check whether the task received a stop signal from the workflow.
Tasks can use the stop flag to gracefully terminate their work. This is
particularly important for long running tasks and tasks that employ an
infinite loop, such as trigger tasks.
Return... | def is_stopped(self):
""" Check whether the task received a stop signal from the workflow.
Tasks can use the stop flag to gracefully terminate their work. This is
particularly important for long running tasks and tasks that employ an
infinite loop, such as trigger tasks.
Return... | [
"Check",
"whether",
"the",
"task",
"received",
"a",
"stop",
"signal",
"from",
"the",
"workflow",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_signal.py#L90-L106 | [
"def",
"is_stopped",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"_client",
".",
"send",
"(",
"Request",
"(",
"action",
"=",
"'is_dag_stopped'",
",",
"payload",
"=",
"{",
"'dag_name'",
":",
"self",
".",
"_dag_name",
"}",
")",
")",
"return",
"resp"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | event_stream | Generator function that returns celery events.
This function turns the callback based celery event handling into a generator.
Args:
app: Reference to a celery application object.
filter_by_prefix (str): If not None, only allow events that have a type that
start... | lightflow/queue/event.py | def event_stream(app, *, filter_by_prefix=None):
""" Generator function that returns celery events.
This function turns the callback based celery event handling into a generator.
Args:
app: Reference to a celery application object.
filter_by_prefix (str): If not None, only allow events tha... | def event_stream(app, *, filter_by_prefix=None):
""" Generator function that returns celery events.
This function turns the callback based celery event handling into a generator.
Args:
app: Reference to a celery application object.
filter_by_prefix (str): If not None, only allow events tha... | [
"Generator",
"function",
"that",
"returns",
"celery",
"events",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/event.py#L10-L44 | [
"def",
"event_stream",
"(",
"app",
",",
"*",
",",
"filter_by_prefix",
"=",
"None",
")",
":",
"q",
"=",
"Queue",
"(",
")",
"def",
"handle_event",
"(",
"event",
")",
":",
"if",
"filter_by_prefix",
"is",
"None",
"or",
"(",
"filter_by_prefix",
"is",
"not",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | create_event_model | Factory function that turns a celery event into an event object.
Args:
event (dict): A dictionary that represents a celery event.
Returns:
object: An event object representing the received event.
Raises:
JobEventTypeUnsupported: If an unsupported celery job event was received.
... | lightflow/queue/event.py | def create_event_model(event):
""" Factory function that turns a celery event into an event object.
Args:
event (dict): A dictionary that represents a celery event.
Returns:
object: An event object representing the received event.
Raises:
JobEventTypeUnsupported: If an unsuppo... | def create_event_model(event):
""" Factory function that turns a celery event into an event object.
Args:
event (dict): A dictionary that represents a celery event.
Returns:
object: An event object representing the received event.
Raises:
JobEventTypeUnsupported: If an unsuppo... | [
"Factory",
"function",
"that",
"turns",
"a",
"celery",
"event",
"into",
"an",
"event",
"object",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/event.py#L47-L77 | [
"def",
"create_event_model",
"(",
"event",
")",
":",
"if",
"event",
"[",
"'type'",
"]",
".",
"startswith",
"(",
"'task'",
")",
":",
"factory",
"=",
"{",
"JobEventName",
".",
"Started",
":",
"JobStartedEvent",
",",
"JobEventName",
".",
"Succeeded",
":",
"Jo... | dc53dbc1d961e20fb144273baca258060705c03e |
train | config_required | Decorator that checks whether a configuration file was set. | lightflow/scripts/cli.py | def config_required(f):
""" Decorator that checks whether a configuration file was set. """
def new_func(obj, *args, **kwargs):
if 'config' not in obj:
click.echo(_style(obj.get('show_color', False),
'Could not find a valid configuration file!',
... | def config_required(f):
""" Decorator that checks whether a configuration file was set. """
def new_func(obj, *args, **kwargs):
if 'config' not in obj:
click.echo(_style(obj.get('show_color', False),
'Could not find a valid configuration file!',
... | [
"Decorator",
"that",
"checks",
"whether",
"a",
"configuration",
"file",
"was",
"set",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L30-L40 | [
"def",
"config_required",
"(",
"f",
")",
":",
"def",
"new_func",
"(",
"obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'config'",
"not",
"in",
"obj",
":",
"click",
".",
"echo",
"(",
"_style",
"(",
"obj",
".",
"get",
"(",
"'show_... | dc53dbc1d961e20fb144273baca258060705c03e |
train | ingest_config_obj | Ingest the configuration object into the click context. | lightflow/scripts/cli.py | def ingest_config_obj(ctx, *, silent=True):
""" Ingest the configuration object into the click context. """
try:
ctx.obj['config'] = Config.from_file(ctx.obj['config_path'])
except ConfigLoadError as err:
click.echo(_style(ctx.obj['show_color'], str(err), fg='red', bold=True))
if not... | def ingest_config_obj(ctx, *, silent=True):
""" Ingest the configuration object into the click context. """
try:
ctx.obj['config'] = Config.from_file(ctx.obj['config_path'])
except ConfigLoadError as err:
click.echo(_style(ctx.obj['show_color'], str(err), fg='red', bold=True))
if not... | [
"Ingest",
"the",
"configuration",
"object",
"into",
"the",
"click",
"context",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L43-L50 | [
"def",
"ingest_config_obj",
"(",
"ctx",
",",
"*",
",",
"silent",
"=",
"True",
")",
":",
"try",
":",
"ctx",
".",
"obj",
"[",
"'config'",
"]",
"=",
"Config",
".",
"from_file",
"(",
"ctx",
".",
"obj",
"[",
"'config_path'",
"]",
")",
"except",
"ConfigLoa... | dc53dbc1d961e20fb144273baca258060705c03e |
train | cli | Command line client for lightflow. A lightweight, high performance pipeline
system for synchrotrons.
Lightflow is being developed at the Australian Synchrotron. | lightflow/scripts/cli.py | def cli(ctx, config, no_color):
""" Command line client for lightflow. A lightweight, high performance pipeline
system for synchrotrons.
Lightflow is being developed at the Australian Synchrotron.
"""
ctx.obj = {
'show_color': not no_color if no_color is not None else True,
'config_... | def cli(ctx, config, no_color):
""" Command line client for lightflow. A lightweight, high performance pipeline
system for synchrotrons.
Lightflow is being developed at the Australian Synchrotron.
"""
ctx.obj = {
'show_color': not no_color if no_color is not None else True,
'config_... | [
"Command",
"line",
"client",
"for",
"lightflow",
".",
"A",
"lightweight",
"high",
"performance",
"pipeline",
"system",
"for",
"synchrotrons",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L58-L67 | [
"def",
"cli",
"(",
"ctx",
",",
"config",
",",
"no_color",
")",
":",
"ctx",
".",
"obj",
"=",
"{",
"'show_color'",
":",
"not",
"no_color",
"if",
"no_color",
"is",
"not",
"None",
"else",
"True",
",",
"'config_path'",
":",
"config",
"}"
] | dc53dbc1d961e20fb144273baca258060705c03e |
train | config_default | Create a default configuration file.
\b
DEST: Path or file name for the configuration file. | lightflow/scripts/cli.py | def config_default(dest):
""" Create a default configuration file.
\b
DEST: Path or file name for the configuration file.
"""
conf_path = Path(dest).resolve()
if conf_path.is_dir():
conf_path = conf_path / LIGHTFLOW_CONFIG_NAME
conf_path.write_text(Config.default())
click.echo(... | def config_default(dest):
""" Create a default configuration file.
\b
DEST: Path or file name for the configuration file.
"""
conf_path = Path(dest).resolve()
if conf_path.is_dir():
conf_path = conf_path / LIGHTFLOW_CONFIG_NAME
conf_path.write_text(Config.default())
click.echo(... | [
"Create",
"a",
"default",
"configuration",
"file",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L78-L89 | [
"def",
"config_default",
"(",
"dest",
")",
":",
"conf_path",
"=",
"Path",
"(",
"dest",
")",
".",
"resolve",
"(",
")",
"if",
"conf_path",
".",
"is_dir",
"(",
")",
":",
"conf_path",
"=",
"conf_path",
"/",
"LIGHTFLOW_CONFIG_NAME",
"conf_path",
".",
"write_tex... | dc53dbc1d961e20fb144273baca258060705c03e |
train | config_list | List the current configuration. | lightflow/scripts/cli.py | def config_list(ctx):
""" List the current configuration. """
ingest_config_obj(ctx, silent=False)
click.echo(json.dumps(ctx.obj['config'].to_dict(), indent=4)) | def config_list(ctx):
""" List the current configuration. """
ingest_config_obj(ctx, silent=False)
click.echo(json.dumps(ctx.obj['config'].to_dict(), indent=4)) | [
"List",
"the",
"current",
"configuration",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L94-L97 | [
"def",
"config_list",
"(",
"ctx",
")",
":",
"ingest_config_obj",
"(",
"ctx",
",",
"silent",
"=",
"False",
")",
"click",
".",
"echo",
"(",
"json",
".",
"dumps",
"(",
"ctx",
".",
"obj",
"[",
"'config'",
"]",
".",
"to_dict",
"(",
")",
",",
"indent",
"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | config_examples | Copy the example workflows to a directory.
\b
DEST: Path to which the examples should be copied. | lightflow/scripts/cli.py | def config_examples(dest, user_dir):
""" Copy the example workflows to a directory.
\b
DEST: Path to which the examples should be copied.
"""
examples_path = Path(lightflow.__file__).parents[1] / 'examples'
if examples_path.exists():
dest_path = Path(dest).resolve()
if not user_... | def config_examples(dest, user_dir):
""" Copy the example workflows to a directory.
\b
DEST: Path to which the examples should be copied.
"""
examples_path = Path(lightflow.__file__).parents[1] / 'examples'
if examples_path.exists():
dest_path = Path(dest).resolve()
if not user_... | [
"Copy",
"the",
"example",
"workflows",
"to",
"a",
"directory",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L104-L127 | [
"def",
"config_examples",
"(",
"dest",
",",
"user_dir",
")",
":",
"examples_path",
"=",
"Path",
"(",
"lightflow",
".",
"__file__",
")",
".",
"parents",
"[",
"1",
"]",
"/",
"'examples'",
"if",
"examples_path",
".",
"exists",
"(",
")",
":",
"dest_path",
"=... | dc53dbc1d961e20fb144273baca258060705c03e |
train | workflow_list | List all available workflows. | lightflow/scripts/cli.py | def workflow_list(obj):
""" List all available workflows. """
try:
for wf in list_workflows(config=obj['config']):
click.echo('{:23} {}'.format(
_style(obj['show_color'], wf.name, bold=True),
wf.docstring.split('\n')[0] if wf.docstring is not None else ''))
... | def workflow_list(obj):
""" List all available workflows. """
try:
for wf in list_workflows(config=obj['config']):
click.echo('{:23} {}'.format(
_style(obj['show_color'], wf.name, bold=True),
wf.docstring.split('\n')[0] if wf.docstring is not None else ''))
... | [
"List",
"all",
"available",
"workflows",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L140-L150 | [
"def",
"workflow_list",
"(",
"obj",
")",
":",
"try",
":",
"for",
"wf",
"in",
"list_workflows",
"(",
"config",
"=",
"obj",
"[",
"'config'",
"]",
")",
":",
"click",
".",
"echo",
"(",
"'{:23} {}'",
".",
"format",
"(",
"_style",
"(",
"obj",
"[",
"'show_c... | dc53dbc1d961e20fb144273baca258060705c03e |
train | workflow_start | Send a workflow to the queue.
\b
NAME: The name of the workflow that should be started.
WORKFLOW_ARGS: Workflow arguments in the form key1=value1 key2=value2. | lightflow/scripts/cli.py | def workflow_start(obj, queue, keep_data, name, workflow_args):
""" Send a workflow to the queue.
\b
NAME: The name of the workflow that should be started.
WORKFLOW_ARGS: Workflow arguments in the form key1=value1 key2=value2.
"""
try:
start_workflow(name=name,
co... | def workflow_start(obj, queue, keep_data, name, workflow_args):
""" Send a workflow to the queue.
\b
NAME: The name of the workflow that should be started.
WORKFLOW_ARGS: Workflow arguments in the form key1=value1 key2=value2.
"""
try:
start_workflow(name=name,
co... | [
"Send",
"a",
"workflow",
"to",
"the",
"queue",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L163-L185 | [
"def",
"workflow_start",
"(",
"obj",
",",
"queue",
",",
"keep_data",
",",
"name",
",",
"workflow_args",
")",
":",
"try",
":",
"start_workflow",
"(",
"name",
"=",
"name",
",",
"config",
"=",
"obj",
"[",
"'config'",
"]",
",",
"queue",
"=",
"queue",
",",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | workflow_stop | Stop one or more running workflows.
\b
NAMES: The names, ids or job ids of the workflows that should be stopped.
Leave empty to stop all running workflows. | lightflow/scripts/cli.py | def workflow_stop(obj, names):
""" Stop one or more running workflows.
\b
NAMES: The names, ids or job ids of the workflows that should be stopped.
Leave empty to stop all running workflows.
"""
if len(names) == 0:
msg = 'Would you like to stop all workflows?'
else:
m... | def workflow_stop(obj, names):
""" Stop one or more running workflows.
\b
NAMES: The names, ids or job ids of the workflows that should be stopped.
Leave empty to stop all running workflows.
"""
if len(names) == 0:
msg = 'Would you like to stop all workflows?'
else:
m... | [
"Stop",
"one",
"or",
"more",
"running",
"workflows",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L192-L206 | [
"def",
"workflow_stop",
"(",
"obj",
",",
"names",
")",
":",
"if",
"len",
"(",
"names",
")",
"==",
"0",
":",
"msg",
"=",
"'Would you like to stop all workflows?'",
"else",
":",
"msg",
"=",
"'\\n{}\\n\\n{}'",
".",
"format",
"(",
"'\\n'",
".",
"join",
"(",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | workflow_status | Show the status of the workflows. | lightflow/scripts/cli.py | def workflow_status(obj, details):
""" Show the status of the workflows. """
show_colors = obj['show_color']
config_cli = obj['config'].cli
if details:
temp_form = '{:>{}} {:20} {:25} {:25} {:38} {}'
else:
temp_form = '{:>{}} {:20} {:25} {} {} {}'
click.echo('\n')
click.e... | def workflow_status(obj, details):
""" Show the status of the workflows. """
show_colors = obj['show_color']
config_cli = obj['config'].cli
if details:
temp_form = '{:>{}} {:20} {:25} {:25} {:38} {}'
else:
temp_form = '{:>{}} {:20} {:25} {} {} {}'
click.echo('\n')
click.e... | [
"Show",
"the",
"status",
"of",
"the",
"workflows",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L213-L272 | [
"def",
"workflow_status",
"(",
"obj",
",",
"details",
")",
":",
"show_colors",
"=",
"obj",
"[",
"'show_color'",
"]",
"config_cli",
"=",
"obj",
"[",
"'config'",
"]",
".",
"cli",
"if",
"details",
":",
"temp_form",
"=",
"'{:>{}} {:20} {:25} {:25} {:38} {}'",
"el... | dc53dbc1d961e20fb144273baca258060705c03e |
train | worker_start | Start a worker process.
\b
CELERY_ARGS: Additional Celery worker command line arguments. | lightflow/scripts/cli.py | def worker_start(obj, queues, name, celery_args):
""" Start a worker process.
\b
CELERY_ARGS: Additional Celery worker command line arguments.
"""
try:
start_worker(queues=queues.split(','),
config=obj['config'],
name=name,
cele... | def worker_start(obj, queues, name, celery_args):
""" Start a worker process.
\b
CELERY_ARGS: Additional Celery worker command line arguments.
"""
try:
start_worker(queues=queues.split(','),
config=obj['config'],
name=name,
cele... | [
"Start",
"a",
"worker",
"process",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L292-L306 | [
"def",
"worker_start",
"(",
"obj",
",",
"queues",
",",
"name",
",",
"celery_args",
")",
":",
"try",
":",
"start_worker",
"(",
"queues",
"=",
"queues",
".",
"split",
"(",
"','",
")",
",",
"config",
"=",
"obj",
"[",
"'config'",
"]",
",",
"name",
"=",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | worker_stop | Stop running workers.
\b
WORKER_IDS: The IDs of the worker that should be stopped or none to stop them all. | lightflow/scripts/cli.py | def worker_stop(obj, worker_ids):
""" Stop running workers.
\b
WORKER_IDS: The IDs of the worker that should be stopped or none to stop them all.
"""
if len(worker_ids) == 0:
msg = 'Would you like to stop all workers?'
else:
msg = '\n{}\n\n{}'.format('\n'.join(worker_ids),
... | def worker_stop(obj, worker_ids):
""" Stop running workers.
\b
WORKER_IDS: The IDs of the worker that should be stopped or none to stop them all.
"""
if len(worker_ids) == 0:
msg = 'Would you like to stop all workers?'
else:
msg = '\n{}\n\n{}'.format('\n'.join(worker_ids),
... | [
"Stop",
"running",
"workers",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L313-L327 | [
"def",
"worker_stop",
"(",
"obj",
",",
"worker_ids",
")",
":",
"if",
"len",
"(",
"worker_ids",
")",
"==",
"0",
":",
"msg",
"=",
"'Would you like to stop all workers?'",
"else",
":",
"msg",
"=",
"'\\n{}\\n\\n{}'",
".",
"format",
"(",
"'\\n'",
".",
"join",
"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | worker_status | Show the status of all running workers. | lightflow/scripts/cli.py | def worker_status(obj, filter_queues, details):
""" Show the status of all running workers. """
show_colors = obj['show_color']
f_queues = filter_queues.split(',') if filter_queues is not None else None
workers = list_workers(config=obj['config'], filter_by_queues=f_queues)
if len(workers) == 0:
... | def worker_status(obj, filter_queues, details):
""" Show the status of all running workers. """
show_colors = obj['show_color']
f_queues = filter_queues.split(',') if filter_queues is not None else None
workers = list_workers(config=obj['config'], filter_by_queues=f_queues)
if len(workers) == 0:
... | [
"Show",
"the",
"status",
"of",
"all",
"running",
"workers",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L336-L384 | [
"def",
"worker_status",
"(",
"obj",
",",
"filter_queues",
",",
"details",
")",
":",
"show_colors",
"=",
"obj",
"[",
"'show_color'",
"]",
"f_queues",
"=",
"filter_queues",
".",
"split",
"(",
"','",
")",
"if",
"filter_queues",
"is",
"not",
"None",
"else",
"N... | dc53dbc1d961e20fb144273baca258060705c03e |
train | monitor | Show the worker and workflow event stream. | lightflow/scripts/cli.py | def monitor(ctx, details):
""" Show the worker and workflow event stream. """
ingest_config_obj(ctx, silent=False)
show_colors = ctx.obj['show_color']
event_display = {
JobEventName.Started: {'color': 'blue', 'label': 'started'},
JobEventName.Succeeded: {'color': 'green', 'label': 'suc... | def monitor(ctx, details):
""" Show the worker and workflow event stream. """
ingest_config_obj(ctx, silent=False)
show_colors = ctx.obj['show_color']
event_display = {
JobEventName.Started: {'color': 'blue', 'label': 'started'},
JobEventName.Succeeded: {'color': 'green', 'label': 'suc... | [
"Show",
"the",
"worker",
"and",
"workflow",
"event",
"stream",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L390-L426 | [
"def",
"monitor",
"(",
"ctx",
",",
"details",
")",
":",
"ingest_config_obj",
"(",
"ctx",
",",
"silent",
"=",
"False",
")",
"show_colors",
"=",
"ctx",
".",
"obj",
"[",
"'show_color'",
"]",
"event_display",
"=",
"{",
"JobEventName",
".",
"Started",
":",
"{... | dc53dbc1d961e20fb144273baca258060705c03e |
train | ext | Run an extension by its name.
\b
EXT_NAME: The name of the extension.
EXT_ARGS: Arguments that are passed to the extension. | lightflow/scripts/cli.py | def ext(obj, ext_name, ext_args):
""" Run an extension by its name.
\b
EXT_NAME: The name of the extension.
EXT_ARGS: Arguments that are passed to the extension.
"""
try:
mod = import_module('lightflow_{}.__main__'.format(ext_name))
mod.main(ext_args)
except ImportError as e... | def ext(obj, ext_name, ext_args):
""" Run an extension by its name.
\b
EXT_NAME: The name of the extension.
EXT_ARGS: Arguments that are passed to the extension.
"""
try:
mod = import_module('lightflow_{}.__main__'.format(ext_name))
mod.main(ext_args)
except ImportError as e... | [
"Run",
"an",
"extension",
"by",
"its",
"name",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L433-L447 | [
"def",
"ext",
"(",
"obj",
",",
"ext_name",
",",
"ext_args",
")",
":",
"try",
":",
"mod",
"=",
"import_module",
"(",
"'lightflow_{}.__main__'",
".",
"format",
"(",
"ext_name",
")",
")",
"mod",
".",
"main",
"(",
"ext_args",
")",
"except",
"ImportError",
"a... | dc53dbc1d961e20fb144273baca258060705c03e |
train | _style | Helper function to enable/disable styled output text.
Args:
enable (bool): Turn on or off styling.
text (string): The string that should be styled.
kwargs (dict): Parameters that are passed through to click.style
Returns:
string: The input with either the styling applied (enabl... | lightflow/scripts/cli.py | def _style(enabled, text, **kwargs):
""" Helper function to enable/disable styled output text.
Args:
enable (bool): Turn on or off styling.
text (string): The string that should be styled.
kwargs (dict): Parameters that are passed through to click.style
Returns:
string: The... | def _style(enabled, text, **kwargs):
""" Helper function to enable/disable styled output text.
Args:
enable (bool): Turn on or off styling.
text (string): The string that should be styled.
kwargs (dict): Parameters that are passed through to click.style
Returns:
string: The... | [
"Helper",
"function",
"to",
"enable",
"/",
"disable",
"styled",
"output",
"text",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/scripts/cli.py#L450-L465 | [
"def",
"_style",
"(",
"enabled",
",",
"text",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"enabled",
":",
"return",
"click",
".",
"style",
"(",
"text",
",",
"*",
"*",
"kwargs",
")",
"else",
":",
"return",
"text"
] | dc53dbc1d961e20fb144273baca258060705c03e |
train | freq_to_band | converts a Frequency [kHz] into the band and mode according to the IARU bandplan
Note:
**DEPRECATION NOTICE**
This function has been moved to pyhamtools.frequency with PyHamTools 0.4.1
Please don't use this module/function anymore. It will be removed soon. | pyhamtools/utils.py | def freq_to_band(freq):
"""converts a Frequency [kHz] into the band and mode according to the IARU bandplan
Note:
**DEPRECATION NOTICE**
This function has been moved to pyhamtools.frequency with PyHamTools 0.4.1
Please don't use this module/function anymore. It will be r... | def freq_to_band(freq):
"""converts a Frequency [kHz] into the band and mode according to the IARU bandplan
Note:
**DEPRECATION NOTICE**
This function has been moved to pyhamtools.frequency with PyHamTools 0.4.1
Please don't use this module/function anymore. It will be r... | [
"converts",
"a",
"Frequency",
"[",
"kHz",
"]",
"into",
"the",
"band",
"and",
"mode",
"according",
"to",
"the",
"IARU",
"bandplan"
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/utils.py#L4-L143 | [
"def",
"freq_to_band",
"(",
"freq",
")",
":",
"band",
"=",
"None",
"mode",
"=",
"None",
"if",
"(",
"(",
"freq",
">=",
"135",
")",
"and",
"(",
"freq",
"<=",
"138",
")",
")",
":",
"band",
"=",
"2190",
"mode",
"=",
"const",
".",
"CW",
"elif",
"(",... | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | create_app | Create a fully configured Celery application object.
Args:
config (Config): A reference to a lightflow configuration object.
Returns:
Celery: A fully configured Celery application object. | lightflow/queue/app.py | def create_app(config):
""" Create a fully configured Celery application object.
Args:
config (Config): A reference to a lightflow configuration object.
Returns:
Celery: A fully configured Celery application object.
"""
# configure the celery logging system with the lightflow sett... | def create_app(config):
""" Create a fully configured Celery application object.
Args:
config (Config): A reference to a lightflow configuration object.
Returns:
Celery: A fully configured Celery application object.
"""
# configure the celery logging system with the lightflow sett... | [
"Create",
"a",
"fully",
"configured",
"Celery",
"application",
"object",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/app.py#L16-L53 | [
"def",
"create_app",
"(",
"config",
")",
":",
"# configure the celery logging system with the lightflow settings",
"setup_logging",
".",
"connect",
"(",
"partial",
"(",
"_initialize_logging",
",",
"config",
")",
",",
"weak",
"=",
"False",
")",
"task_postrun",
".",
"co... | dc53dbc1d961e20fb144273baca258060705c03e |
train | _cleanup_workflow | Cleanup the results of a workflow when it finished.
Connects to the postrun signal of Celery. If the signal was sent by a workflow,
remove the result from the result backend.
Args:
task_id (str): The id of the task.
args (tuple): The arguments the task was started with.
**kwargs: K... | lightflow/queue/app.py | def _cleanup_workflow(config, task_id, args, **kwargs):
""" Cleanup the results of a workflow when it finished.
Connects to the postrun signal of Celery. If the signal was sent by a workflow,
remove the result from the result backend.
Args:
task_id (str): The id of the task.
args (tupl... | def _cleanup_workflow(config, task_id, args, **kwargs):
""" Cleanup the results of a workflow when it finished.
Connects to the postrun signal of Celery. If the signal was sent by a workflow,
remove the result from the result backend.
Args:
task_id (str): The id of the task.
args (tupl... | [
"Cleanup",
"the",
"results",
"of",
"a",
"workflow",
"when",
"it",
"finished",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/app.py#L70-L84 | [
"def",
"_cleanup_workflow",
"(",
"config",
",",
"task_id",
",",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"lightflow",
".",
"models",
"import",
"Workflow",
"if",
"isinstance",
"(",
"args",
"[",
"0",
"]",
",",
"Workflow",
")",
":",
"if",
"confi... | dc53dbc1d961e20fb144273baca258060705c03e |
train | execute_workflow | Celery task (aka job) that runs a workflow on a worker.
This celery task starts, manages and monitors the dags that make up a workflow.
Args:
self (Task): Reference to itself, the celery task object.
workflow (Workflow): Reference to the workflow object that is being used to
... | lightflow/queue/jobs.py | def execute_workflow(self, workflow, workflow_id=None):
""" Celery task (aka job) that runs a workflow on a worker.
This celery task starts, manages and monitors the dags that make up a workflow.
Args:
self (Task): Reference to itself, the celery task object.
workflow (Workflow): Reference... | def execute_workflow(self, workflow, workflow_id=None):
""" Celery task (aka job) that runs a workflow on a worker.
This celery task starts, manages and monitors the dags that make up a workflow.
Args:
self (Task): Reference to itself, the celery task object.
workflow (Workflow): Reference... | [
"Celery",
"task",
"(",
"aka",
"job",
")",
"that",
"runs",
"a",
"workflow",
"on",
"a",
"worker",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/jobs.py#L17-L96 | [
"def",
"execute_workflow",
"(",
"self",
",",
"workflow",
",",
"workflow_id",
"=",
"None",
")",
":",
"start_time",
"=",
"datetime",
".",
"utcnow",
"(",
")",
"logger",
".",
"info",
"(",
"'Running workflow <{}>'",
".",
"format",
"(",
"workflow",
".",
"name",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | execute_dag | Celery task that runs a single dag on a worker.
This celery task starts, manages and monitors the individual tasks of a dag.
Args:
self (Task): Reference to itself, the celery task object.
dag (Dag): Reference to a Dag object that is being used to start, manage and
monitor t... | lightflow/queue/jobs.py | def execute_dag(self, dag, workflow_id, data=None):
""" Celery task that runs a single dag on a worker.
This celery task starts, manages and monitors the individual tasks of a dag.
Args:
self (Task): Reference to itself, the celery task object.
dag (Dag): Reference to a Dag object that is ... | def execute_dag(self, dag, workflow_id, data=None):
""" Celery task that runs a single dag on a worker.
This celery task starts, manages and monitors the individual tasks of a dag.
Args:
self (Task): Reference to itself, the celery task object.
dag (Dag): Reference to a Dag object that is ... | [
"Celery",
"task",
"that",
"runs",
"a",
"single",
"dag",
"on",
"a",
"worker",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/jobs.py#L100-L168 | [
"def",
"execute_dag",
"(",
"self",
",",
"dag",
",",
"workflow_id",
",",
"data",
"=",
"None",
")",
":",
"start_time",
"=",
"datetime",
".",
"utcnow",
"(",
")",
"logger",
".",
"info",
"(",
"'Running DAG <{}>'",
".",
"format",
"(",
"dag",
".",
"name",
")"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | execute_task | Celery task that runs a single task on a worker.
Args:
self (Task): Reference to itself, the celery task object.
task (BaseTask): Reference to the task object that performs the work
in its run() method.
workflow_id (string): The unique ID of the workflow run that st... | lightflow/queue/jobs.py | def execute_task(self, task, workflow_id, data=None):
""" Celery task that runs a single task on a worker.
Args:
self (Task): Reference to itself, the celery task object.
task (BaseTask): Reference to the task object that performs the work
in its run() method.
w... | def execute_task(self, task, workflow_id, data=None):
""" Celery task that runs a single task on a worker.
Args:
self (Task): Reference to itself, the celery task object.
task (BaseTask): Reference to the task object that performs the work
in its run() method.
w... | [
"Celery",
"task",
"that",
"runs",
"a",
"single",
"task",
"on",
"a",
"worker",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/jobs.py#L172-L265 | [
"def",
"execute_task",
"(",
"self",
",",
"task",
",",
"workflow_id",
",",
"data",
"=",
"None",
")",
":",
"start_time",
"=",
"datetime",
".",
"utcnow",
"(",
")",
"store_doc",
"=",
"DataStore",
"(",
"*",
"*",
"self",
".",
"app",
".",
"user_options",
"[",... | dc53dbc1d961e20fb144273baca258060705c03e |
train | BrokerStats.from_celery | Create a BrokerStats object from the dictionary returned by celery.
Args:
broker_dict (dict): The dictionary as returned by celery.
Returns:
BrokerStats: A fully initialized BrokerStats object. | lightflow/queue/models.py | def from_celery(cls, broker_dict):
""" Create a BrokerStats object from the dictionary returned by celery.
Args:
broker_dict (dict): The dictionary as returned by celery.
Returns:
BrokerStats: A fully initialized BrokerStats object.
"""
return BrokerStat... | def from_celery(cls, broker_dict):
""" Create a BrokerStats object from the dictionary returned by celery.
Args:
broker_dict (dict): The dictionary as returned by celery.
Returns:
BrokerStats: A fully initialized BrokerStats object.
"""
return BrokerStat... | [
"Create",
"a",
"BrokerStats",
"object",
"from",
"the",
"dictionary",
"returned",
"by",
"celery",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/models.py#L22-L36 | [
"def",
"from_celery",
"(",
"cls",
",",
"broker_dict",
")",
":",
"return",
"BrokerStats",
"(",
"hostname",
"=",
"broker_dict",
"[",
"'hostname'",
"]",
",",
"port",
"=",
"broker_dict",
"[",
"'port'",
"]",
",",
"transport",
"=",
"broker_dict",
"[",
"'transport'... | dc53dbc1d961e20fb144273baca258060705c03e |
train | BrokerStats.to_dict | Return a dictionary of the broker stats.
Returns:
dict: Dictionary of the stats. | lightflow/queue/models.py | def to_dict(self):
""" Return a dictionary of the broker stats.
Returns:
dict: Dictionary of the stats.
"""
return {
'hostname': self.hostname,
'port': self.port,
'transport': self.transport,
'virtual_host': self.virtual_host
... | def to_dict(self):
""" Return a dictionary of the broker stats.
Returns:
dict: Dictionary of the stats.
"""
return {
'hostname': self.hostname,
'port': self.port,
'transport': self.transport,
'virtual_host': self.virtual_host
... | [
"Return",
"a",
"dictionary",
"of",
"the",
"broker",
"stats",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/models.py#L38-L49 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"return",
"{",
"'hostname'",
":",
"self",
".",
"hostname",
",",
"'port'",
":",
"self",
".",
"port",
",",
"'transport'",
":",
"self",
".",
"transport",
",",
"'virtual_host'",
":",
"self",
".",
"virtual_host",
"}"
] | dc53dbc1d961e20fb144273baca258060705c03e |
train | WorkerStats.from_celery | Create a WorkerStats object from the dictionary returned by celery.
Args:
name (str): The name of the worker.
worker_dict (dict): The dictionary as returned by celery.
queues (list): A list of QueueStats objects that represent the queues this
worker is listen... | lightflow/queue/models.py | def from_celery(cls, name, worker_dict, queues):
""" Create a WorkerStats object from the dictionary returned by celery.
Args:
name (str): The name of the worker.
worker_dict (dict): The dictionary as returned by celery.
queues (list): A list of QueueStats objects th... | def from_celery(cls, name, worker_dict, queues):
""" Create a WorkerStats object from the dictionary returned by celery.
Args:
name (str): The name of the worker.
worker_dict (dict): The dictionary as returned by celery.
queues (list): A list of QueueStats objects th... | [
"Create",
"a",
"WorkerStats",
"object",
"from",
"the",
"dictionary",
"returned",
"by",
"celery",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/models.py#L114-L134 | [
"def",
"from_celery",
"(",
"cls",
",",
"name",
",",
"worker_dict",
",",
"queues",
")",
":",
"return",
"WorkerStats",
"(",
"name",
"=",
"name",
",",
"broker",
"=",
"BrokerStats",
".",
"from_celery",
"(",
"worker_dict",
"[",
"'broker'",
"]",
")",
",",
"pid... | dc53dbc1d961e20fb144273baca258060705c03e |
train | WorkerStats.to_dict | Return a dictionary of the worker stats.
Returns:
dict: Dictionary of the stats. | lightflow/queue/models.py | def to_dict(self):
""" Return a dictionary of the worker stats.
Returns:
dict: Dictionary of the stats.
"""
return {
'name': self.name,
'broker': self.broker.to_dict(),
'pid': self.pid,
'process_pids': self.process_pids,
... | def to_dict(self):
""" Return a dictionary of the worker stats.
Returns:
dict: Dictionary of the stats.
"""
return {
'name': self.name,
'broker': self.broker.to_dict(),
'pid': self.pid,
'process_pids': self.process_pids,
... | [
"Return",
"a",
"dictionary",
"of",
"the",
"worker",
"stats",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/models.py#L136-L150 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"return",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'broker'",
":",
"self",
".",
"broker",
".",
"to_dict",
"(",
")",
",",
"'pid'",
":",
"self",
".",
"pid",
",",
"'process_pids'",
":",
"self",
".",
"proc... | dc53dbc1d961e20fb144273baca258060705c03e |
train | JobStats.from_celery | Create a JobStats object from the dictionary returned by celery.
Args:
worker_name (str): The name of the worker this jobs runs on.
job_dict (dict): The dictionary as returned by celery.
celery_app: Reference to a celery application object.
Returns:
JobS... | lightflow/queue/models.py | def from_celery(cls, worker_name, job_dict, celery_app):
""" Create a JobStats object from the dictionary returned by celery.
Args:
worker_name (str): The name of the worker this jobs runs on.
job_dict (dict): The dictionary as returned by celery.
celery_app: Referen... | def from_celery(cls, worker_name, job_dict, celery_app):
""" Create a JobStats object from the dictionary returned by celery.
Args:
worker_name (str): The name of the worker this jobs runs on.
job_dict (dict): The dictionary as returned by celery.
celery_app: Referen... | [
"Create",
"a",
"JobStats",
"object",
"from",
"the",
"dictionary",
"returned",
"by",
"celery",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/models.py#L188-L219 | [
"def",
"from_celery",
"(",
"cls",
",",
"worker_name",
",",
"job_dict",
",",
"celery_app",
")",
":",
"if",
"not",
"isinstance",
"(",
"job_dict",
",",
"dict",
")",
"or",
"'id'",
"not",
"in",
"job_dict",
":",
"raise",
"JobStatInvalid",
"(",
"'The job descriptio... | dc53dbc1d961e20fb144273baca258060705c03e |
train | JobStats.to_dict | Return a dictionary of the job stats.
Returns:
dict: Dictionary of the stats. | lightflow/queue/models.py | def to_dict(self):
""" Return a dictionary of the job stats.
Returns:
dict: Dictionary of the stats.
"""
return {
'name': self.name,
'id': self.id,
'type': self.type,
'workflow_id': self.workflow_id,
'queue': self.q... | def to_dict(self):
""" Return a dictionary of the job stats.
Returns:
dict: Dictionary of the stats.
"""
return {
'name': self.name,
'id': self.id,
'type': self.type,
'workflow_id': self.workflow_id,
'queue': self.q... | [
"Return",
"a",
"dictionary",
"of",
"the",
"job",
"stats",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/models.py#L221-L241 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"return",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'id'",
":",
"self",
".",
"id",
",",
"'type'",
":",
"self",
".",
"type",
",",
"'workflow_id'",
":",
"self",
".",
"workflow_id",
",",
"'queue'",
":",
"s... | dc53dbc1d961e20fb144273baca258060705c03e |
train | JobEvent.from_event | Create a JobEvent object from the event dictionary returned by celery.
Args:
event (dict): The dictionary as returned by celery.
Returns:
JobEvent: A fully initialized JobEvent object. | lightflow/queue/models.py | def from_event(cls, event):
""" Create a JobEvent object from the event dictionary returned by celery.
Args:
event (dict): The dictionary as returned by celery.
Returns:
JobEvent: A fully initialized JobEvent object.
"""
return cls(
uuid=even... | def from_event(cls, event):
""" Create a JobEvent object from the event dictionary returned by celery.
Args:
event (dict): The dictionary as returned by celery.
Returns:
JobEvent: A fully initialized JobEvent object.
"""
return cls(
uuid=even... | [
"Create",
"a",
"JobEvent",
"object",
"from",
"the",
"event",
"dictionary",
"returned",
"by",
"celery",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/queue/models.py#L273-L293 | [
"def",
"from_event",
"(",
"cls",
",",
"event",
")",
":",
"return",
"cls",
"(",
"uuid",
"=",
"event",
"[",
"'uuid'",
"]",
",",
"job_type",
"=",
"event",
"[",
"'job_type'",
"]",
",",
"event_type",
"=",
"event",
"[",
"'type'",
"]",
",",
"queue",
"=",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | start_workflow | Start a single workflow by sending it to the workflow queue.
Args:
name (str): The name of the workflow that should be started. Refers to the
name of the workflow file without the .py extension.
config (Config): Reference to the configuration object from which the
settings f... | lightflow/workflows.py | def start_workflow(name, config, *, queue=DefaultJobQueueName.Workflow,
clear_data_store=True, store_args=None):
""" Start a single workflow by sending it to the workflow queue.
Args:
name (str): The name of the workflow that should be started. Refers to the
name of the w... | def start_workflow(name, config, *, queue=DefaultJobQueueName.Workflow,
clear_data_store=True, store_args=None):
""" Start a single workflow by sending it to the workflow queue.
Args:
name (str): The name of the workflow that should be started. Refers to the
name of the w... | [
"Start",
"a",
"single",
"workflow",
"by",
"sending",
"it",
"to",
"the",
"workflow",
"queue",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/workflows.py#L16-L49 | [
"def",
"start_workflow",
"(",
"name",
",",
"config",
",",
"*",
",",
"queue",
"=",
"DefaultJobQueueName",
".",
"Workflow",
",",
"clear_data_store",
"=",
"True",
",",
"store_args",
"=",
"None",
")",
":",
"try",
":",
"wf",
"=",
"Workflow",
".",
"from_name",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | stop_workflow | Stop one or more workflows.
Args:
config (Config): Reference to the configuration object from which the
settings for the workflow are retrieved.
names (list): List of workflow names, workflow ids or workflow job ids for the
workflows that should be stopped. If all workflows ... | lightflow/workflows.py | def stop_workflow(config, *, names=None):
""" Stop one or more workflows.
Args:
config (Config): Reference to the configuration object from which the
settings for the workflow are retrieved.
names (list): List of workflow names, workflow ids or workflow job ids for the
w... | def stop_workflow(config, *, names=None):
""" Stop one or more workflows.
Args:
config (Config): Reference to the configuration object from which the
settings for the workflow are retrieved.
names (list): List of workflow names, workflow ids or workflow job ids for the
w... | [
"Stop",
"one",
"or",
"more",
"workflows",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/workflows.py#L52-L87 | [
"def",
"stop_workflow",
"(",
"config",
",",
"*",
",",
"names",
"=",
"None",
")",
":",
"jobs",
"=",
"list_jobs",
"(",
"config",
",",
"filter_by_type",
"=",
"JobType",
".",
"Workflow",
")",
"if",
"names",
"is",
"not",
"None",
":",
"filtered_jobs",
"=",
"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | list_workflows | List all available workflows.
Returns a list of all workflows that are available from the paths specified
in the config. A workflow is defined as a Python file with at least one DAG.
Args:
config (Config): Reference to the configuration object from which the
settings are retrieved.
... | lightflow/workflows.py | def list_workflows(config):
""" List all available workflows.
Returns a list of all workflows that are available from the paths specified
in the config. A workflow is defined as a Python file with at least one DAG.
Args:
config (Config): Reference to the configuration object from which the
... | def list_workflows(config):
""" List all available workflows.
Returns a list of all workflows that are available from the paths specified
in the config. A workflow is defined as a Python file with at least one DAG.
Args:
config (Config): Reference to the configuration object from which the
... | [
"List",
"all",
"available",
"workflows",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/workflows.py#L90-L119 | [
"def",
"list_workflows",
"(",
"config",
")",
":",
"workflows",
"=",
"[",
"]",
"for",
"path",
"in",
"config",
".",
"workflows",
":",
"filenames",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"abspath",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | list_jobs | Return a list of Celery jobs.
Args:
config (Config): Reference to the configuration object from which the
settings are retrieved.
status (JobStatus): The status of the jobs that should be returned.
filter_by_type (list): Restrict the returned jobs to the types in this list.
... | lightflow/workflows.py | def list_jobs(config, *, status=JobStatus.Active,
filter_by_type=None, filter_by_worker=None):
""" Return a list of Celery jobs.
Args:
config (Config): Reference to the configuration object from which the
settings are retrieved.
status (JobStatus): The status of the jo... | def list_jobs(config, *, status=JobStatus.Active,
filter_by_type=None, filter_by_worker=None):
""" Return a list of Celery jobs.
Args:
config (Config): Reference to the configuration object from which the
settings are retrieved.
status (JobStatus): The status of the jo... | [
"Return",
"a",
"list",
"of",
"Celery",
"jobs",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/workflows.py#L122-L174 | [
"def",
"list_jobs",
"(",
"config",
",",
"*",
",",
"status",
"=",
"JobStatus",
".",
"Active",
",",
"filter_by_type",
"=",
"None",
",",
"filter_by_worker",
"=",
"None",
")",
":",
"celery_app",
"=",
"create_app",
"(",
"config",
")",
"# option to filter by the wor... | dc53dbc1d961e20fb144273baca258060705c03e |
train | events | Return a generator that yields workflow events.
For every workflow event that is sent from celery this generator yields an event
object.
Args:
config (Config): Reference to the configuration object from which the
settings are retrieved.
Returns:
generator: A generator that... | lightflow/workflows.py | def events(config):
""" Return a generator that yields workflow events.
For every workflow event that is sent from celery this generator yields an event
object.
Args:
config (Config): Reference to the configuration object from which the
settings are retrieved.
Returns:
... | def events(config):
""" Return a generator that yields workflow events.
For every workflow event that is sent from celery this generator yields an event
object.
Args:
config (Config): Reference to the configuration object from which the
settings are retrieved.
Returns:
... | [
"Return",
"a",
"generator",
"that",
"yields",
"workflow",
"events",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/workflows.py#L177-L197 | [
"def",
"events",
"(",
"config",
")",
":",
"celery_app",
"=",
"create_app",
"(",
"config",
")",
"for",
"event",
"in",
"event_stream",
"(",
"celery_app",
",",
"filter_by_prefix",
"=",
"'task'",
")",
":",
"try",
":",
"yield",
"create_event_model",
"(",
"event",... | dc53dbc1d961e20fb144273baca258060705c03e |
train | BashTaskOutputReader.run | Drain the process output streams. | lightflow/tasks/bash_task.py | def run(self):
""" Drain the process output streams. """
read_stdout = partial(self._read_output, stream=self._process.stdout,
callback=self._callback_stdout,
output_file=self._stdout_file)
read_stderr = partial(self._read_output, stre... | def run(self):
""" Drain the process output streams. """
read_stdout = partial(self._read_output, stream=self._process.stdout,
callback=self._callback_stdout,
output_file=self._stdout_file)
read_stderr = partial(self._read_output, stre... | [
"Drain",
"the",
"process",
"output",
"streams",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/tasks/bash_task.py#L64-L91 | [
"def",
"run",
"(",
"self",
")",
":",
"read_stdout",
"=",
"partial",
"(",
"self",
".",
"_read_output",
",",
"stream",
"=",
"self",
".",
"_process",
".",
"stdout",
",",
"callback",
"=",
"self",
".",
"_callback_stdout",
",",
"output_file",
"=",
"self",
".",... | dc53dbc1d961e20fb144273baca258060705c03e |
train | BashTaskOutputReader._read_output | Read the output of the process, executed the callback and save the output.
Args:
stream: A file object pointing to the output stream that should be read.
callback(callable, None): A callback function that is called for each new
line of output.
output_file: A ... | lightflow/tasks/bash_task.py | def _read_output(self, stream, callback, output_file):
""" Read the output of the process, executed the callback and save the output.
Args:
stream: A file object pointing to the output stream that should be read.
callback(callable, None): A callback function that is called for e... | def _read_output(self, stream, callback, output_file):
""" Read the output of the process, executed the callback and save the output.
Args:
stream: A file object pointing to the output stream that should be read.
callback(callable, None): A callback function that is called for e... | [
"Read",
"the",
"output",
"of",
"the",
"process",
"executed",
"the",
"callback",
"and",
"save",
"the",
"output",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/tasks/bash_task.py#L93-L119 | [
"def",
"_read_output",
"(",
"self",
",",
"stream",
",",
"callback",
",",
"output_file",
")",
":",
"if",
"(",
"callback",
"is",
"None",
"and",
"output_file",
"is",
"None",
")",
"or",
"stream",
".",
"closed",
":",
"return",
"False",
"line",
"=",
"stream",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | BashTask.run | The main run method of the Python task.
Args:
data (:class:`.MultiTaskData`): The data object that has been passed from the
predecessor task.
store (:class:`.DataStoreDocument`): The persistent data store object that allows the
task to store data for acce... | lightflow/tasks/bash_task.py | def run(self, data, store, signal, context, **kwargs):
""" The main run method of the Python task.
Args:
data (:class:`.MultiTaskData`): The data object that has been passed from the
predecessor task.
store (:class:`.DataStoreDocument`): The persistent data store... | def run(self, data, store, signal, context, **kwargs):
""" The main run method of the Python task.
Args:
data (:class:`.MultiTaskData`): The data object that has been passed from the
predecessor task.
store (:class:`.DataStoreDocument`): The persistent data store... | [
"The",
"main",
"run",
"method",
"of",
"the",
"Python",
"task",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/tasks/bash_task.py#L293-L389 | [
"def",
"run",
"(",
"self",
",",
"data",
",",
"store",
",",
"signal",
",",
"context",
",",
"*",
"*",
"kwargs",
")",
":",
"params",
"=",
"self",
".",
"params",
".",
"eval",
"(",
"data",
",",
"store",
",",
"exclude",
"=",
"[",
"'command'",
"]",
")",... | dc53dbc1d961e20fb144273baca258060705c03e |
train | BashTask._run_as | Function wrapper that sets the user and group for the process | lightflow/tasks/bash_task.py | def _run_as(user, group):
""" Function wrapper that sets the user and group for the process """
def wrapper():
if user is not None:
os.setuid(user)
if group is not None:
os.setgid(group)
return wrapper | def _run_as(user, group):
""" Function wrapper that sets the user and group for the process """
def wrapper():
if user is not None:
os.setuid(user)
if group is not None:
os.setgid(group)
return wrapper | [
"Function",
"wrapper",
"that",
"sets",
"the",
"user",
"and",
"group",
"for",
"the",
"process"
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/tasks/bash_task.py#L392-L399 | [
"def",
"_run_as",
"(",
"user",
",",
"group",
")",
":",
"def",
"wrapper",
"(",
")",
":",
"if",
"user",
"is",
"not",
"None",
":",
"os",
".",
"setuid",
"(",
"user",
")",
"if",
"group",
"is",
"not",
"None",
":",
"os",
".",
"setgid",
"(",
"group",
"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Option.convert | Convert the specified value to the type of the option.
Args:
value: The value that should be converted.
Returns:
The value with the type given by the option. | lightflow/models/parameters.py | def convert(self, value):
""" Convert the specified value to the type of the option.
Args:
value: The value that should be converted.
Returns:
The value with the type given by the option.
"""
if self._type is str:
return str(value)
el... | def convert(self, value):
""" Convert the specified value to the type of the option.
Args:
value: The value that should be converted.
Returns:
The value with the type given by the option.
"""
if self._type is str:
return str(value)
el... | [
"Convert",
"the",
"specified",
"value",
"to",
"the",
"type",
"of",
"the",
"option",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/parameters.py#L62-L93 | [
"def",
"convert",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"_type",
"is",
"str",
":",
"return",
"str",
"(",
"value",
")",
"elif",
"self",
".",
"_type",
"is",
"int",
":",
"try",
":",
"return",
"int",
"(",
"value",
")",
"except",
"("... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Parameters.check_missing | Returns the names of all options that are required but were not specified.
All options that don't have a default value are required in order to run the
workflow.
Args:
args (dict): A dictionary of the provided arguments that is checked for
missing options.
... | lightflow/models/parameters.py | def check_missing(self, args):
""" Returns the names of all options that are required but were not specified.
All options that don't have a default value are required in order to run the
workflow.
Args:
args (dict): A dictionary of the provided arguments that is checked for... | def check_missing(self, args):
""" Returns the names of all options that are required but were not specified.
All options that don't have a default value are required in order to run the
workflow.
Args:
args (dict): A dictionary of the provided arguments that is checked for... | [
"Returns",
"the",
"names",
"of",
"all",
"options",
"that",
"are",
"required",
"but",
"were",
"not",
"specified",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/parameters.py#L99-L114 | [
"def",
"check_missing",
"(",
"self",
",",
"args",
")",
":",
"return",
"[",
"opt",
".",
"name",
"for",
"opt",
"in",
"self",
"if",
"(",
"opt",
".",
"name",
"not",
"in",
"args",
")",
"and",
"(",
"opt",
".",
"default",
"is",
"None",
")",
"]"
] | dc53dbc1d961e20fb144273baca258060705c03e |
train | Parameters.consolidate | Consolidate the provided arguments.
If the provided arguments have matching options, this performs a type conversion.
For any option that has a default value and is not present in the provided
arguments, the default value is added.
Args:
args (dict): A dictionary of the pro... | lightflow/models/parameters.py | def consolidate(self, args):
""" Consolidate the provided arguments.
If the provided arguments have matching options, this performs a type conversion.
For any option that has a default value and is not present in the provided
arguments, the default value is added.
Args:
... | def consolidate(self, args):
""" Consolidate the provided arguments.
If the provided arguments have matching options, this performs a type conversion.
For any option that has a default value and is not present in the provided
arguments, the default value is added.
Args:
... | [
"Consolidate",
"the",
"provided",
"arguments",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/parameters.py#L116-L139 | [
"def",
"consolidate",
"(",
"self",
",",
"args",
")",
":",
"result",
"=",
"dict",
"(",
"args",
")",
"for",
"opt",
"in",
"self",
":",
"if",
"opt",
".",
"name",
"in",
"result",
":",
"result",
"[",
"opt",
".",
"name",
"]",
"=",
"opt",
".",
"convert",... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Dag.define | Store the task graph definition (schema).
The schema has to adhere to the following rules:
A key in the schema dict represents a parent task and the value one or more
children:
{parent: [child]} or {parent: [child1, child2]}
The data output of one task can be routed to a l... | lightflow/models/dag.py | def define(self, schema, *, validate=True):
""" Store the task graph definition (schema).
The schema has to adhere to the following rules:
A key in the schema dict represents a parent task and the value one or more
children:
{parent: [child]} or {parent: [child1, child2]}
... | def define(self, schema, *, validate=True):
""" Store the task graph definition (schema).
The schema has to adhere to the following rules:
A key in the schema dict represents a parent task and the value one or more
children:
{parent: [child]} or {parent: [child1, child2]}
... | [
"Store",
"the",
"task",
"graph",
"definition",
"(",
"schema",
")",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/dag.py#L77-L100 | [
"def",
"define",
"(",
"self",
",",
"schema",
",",
"*",
",",
"validate",
"=",
"True",
")",
":",
"self",
".",
"_schema",
"=",
"schema",
"if",
"validate",
":",
"self",
".",
"validate",
"(",
"self",
".",
"make_graph",
"(",
"self",
".",
"_schema",
")",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Dag.run | Run the dag by calling the tasks in the correct order.
Args:
config (Config): Reference to the configuration object from which the
settings for the dag are retrieved.
workflow_id (str): The unique ID of the workflow that runs this dag.
signal (Da... | lightflow/models/dag.py | def run(self, config, workflow_id, signal, *, data=None):
""" Run the dag by calling the tasks in the correct order.
Args:
config (Config): Reference to the configuration object from which the
settings for the dag are retrieved.
workflow_id (str): Th... | def run(self, config, workflow_id, signal, *, data=None):
""" Run the dag by calling the tasks in the correct order.
Args:
config (Config): Reference to the configuration object from which the
settings for the dag are retrieved.
workflow_id (str): Th... | [
"Run",
"the",
"dag",
"by",
"calling",
"the",
"tasks",
"in",
"the",
"correct",
"order",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/dag.py#L102-L241 | [
"def",
"run",
"(",
"self",
",",
"config",
",",
"workflow_id",
",",
"signal",
",",
"*",
",",
"data",
"=",
"None",
")",
":",
"graph",
"=",
"self",
".",
"make_graph",
"(",
"self",
".",
"_schema",
")",
"# pre-checks",
"self",
".",
"validate",
"(",
"graph... | dc53dbc1d961e20fb144273baca258060705c03e |
train | Dag.validate | Validate the graph by checking whether it is a directed acyclic graph.
Args:
graph (DiGraph): Reference to a DiGraph object from NetworkX.
Raises:
DirectedAcyclicGraphInvalid: If the graph is not a valid dag. | lightflow/models/dag.py | def validate(self, graph):
""" Validate the graph by checking whether it is a directed acyclic graph.
Args:
graph (DiGraph): Reference to a DiGraph object from NetworkX.
Raises:
DirectedAcyclicGraphInvalid: If the graph is not a valid dag.
"""
if not nx.... | def validate(self, graph):
""" Validate the graph by checking whether it is a directed acyclic graph.
Args:
graph (DiGraph): Reference to a DiGraph object from NetworkX.
Raises:
DirectedAcyclicGraphInvalid: If the graph is not a valid dag.
"""
if not nx.... | [
"Validate",
"the",
"graph",
"by",
"checking",
"whether",
"it",
"is",
"a",
"directed",
"acyclic",
"graph",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/dag.py#L243-L253 | [
"def",
"validate",
"(",
"self",
",",
"graph",
")",
":",
"if",
"not",
"nx",
".",
"is_directed_acyclic_graph",
"(",
"graph",
")",
":",
"raise",
"DirectedAcyclicGraphInvalid",
"(",
"graph_name",
"=",
"self",
".",
"_name",
")"
] | dc53dbc1d961e20fb144273baca258060705c03e |
train | Dag.make_graph | Construct the task graph (dag) from a given schema.
Parses the graph schema definition and creates the task graph. Tasks are the
vertices of the graph and the connections defined in the schema become the edges.
A key in the schema dict represents a parent task and the value one or more
... | lightflow/models/dag.py | def make_graph(schema):
""" Construct the task graph (dag) from a given schema.
Parses the graph schema definition and creates the task graph. Tasks are the
vertices of the graph and the connections defined in the schema become the edges.
A key in the schema dict represents a parent ta... | def make_graph(schema):
""" Construct the task graph (dag) from a given schema.
Parses the graph schema definition and creates the task graph. Tasks are the
vertices of the graph and the connections defined in the schema become the edges.
A key in the schema dict represents a parent ta... | [
"Construct",
"the",
"task",
"graph",
"(",
"dag",
")",
"from",
"a",
"given",
"schema",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/dag.py#L256-L318 | [
"def",
"make_graph",
"(",
"schema",
")",
":",
"if",
"schema",
"is",
"None",
":",
"raise",
"DirectedAcyclicGraphUndefined",
"(",
")",
"# sanitize the input schema such that it follows the structure:",
"# {parent: {child_1: slot_1, child_2: slot_2, ...}, ...}",
"sanitized_schema",... | dc53dbc1d961e20fb144273baca258060705c03e |
train | TaskData.merge | Merge the specified dataset on top of the existing data.
This replaces all values in the existing dataset with the values from the
given dataset.
Args:
dataset (TaskData): A reference to the TaskData object that should be merged
on top of the existing object. | lightflow/models/task_data.py | def merge(self, dataset):
""" Merge the specified dataset on top of the existing data.
This replaces all values in the existing dataset with the values from the
given dataset.
Args:
dataset (TaskData): A reference to the TaskData object that should be merged
... | def merge(self, dataset):
""" Merge the specified dataset on top of the existing data.
This replaces all values in the existing dataset with the values from the
given dataset.
Args:
dataset (TaskData): A reference to the TaskData object that should be merged
... | [
"Merge",
"the",
"specified",
"dataset",
"on",
"top",
"of",
"the",
"existing",
"data",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_data.py#L59-L81 | [
"def",
"merge",
"(",
"self",
",",
"dataset",
")",
":",
"def",
"merge_data",
"(",
"source",
",",
"dest",
")",
":",
"for",
"key",
",",
"value",
"in",
"source",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"m... | dc53dbc1d961e20fb144273baca258060705c03e |
train | MultiTaskData.add_dataset | Add a new dataset to the MultiTaskData.
Args:
task_name (str): The name of the task from which the dataset was received.
dataset (TaskData): The dataset that should be added.
aliases (list): A list of aliases that should be registered with the dataset. | lightflow/models/task_data.py | def add_dataset(self, task_name, dataset=None, *, aliases=None):
""" Add a new dataset to the MultiTaskData.
Args:
task_name (str): The name of the task from which the dataset was received.
dataset (TaskData): The dataset that should be added.
aliases (list): A list ... | def add_dataset(self, task_name, dataset=None, *, aliases=None):
""" Add a new dataset to the MultiTaskData.
Args:
task_name (str): The name of the task from which the dataset was received.
dataset (TaskData): The dataset that should be added.
aliases (list): A list ... | [
"Add",
"a",
"new",
"dataset",
"to",
"the",
"MultiTaskData",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_data.py#L146-L163 | [
"def",
"add_dataset",
"(",
"self",
",",
"task_name",
",",
"dataset",
"=",
"None",
",",
"*",
",",
"aliases",
"=",
"None",
")",
":",
"self",
".",
"_datasets",
".",
"append",
"(",
"dataset",
"if",
"dataset",
"is",
"not",
"None",
"else",
"TaskData",
"(",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | MultiTaskData.add_alias | Add an alias pointing to the specified index.
Args:
alias (str): The alias that should point to the given index.
index (int): The index of the dataset for which an alias should be added.
Raises:
DataInvalidIndex: If the index does not represent a valid dataset. | lightflow/models/task_data.py | def add_alias(self, alias, index):
""" Add an alias pointing to the specified index.
Args:
alias (str): The alias that should point to the given index.
index (int): The index of the dataset for which an alias should be added.
Raises:
DataInvalidIndex: If the... | def add_alias(self, alias, index):
""" Add an alias pointing to the specified index.
Args:
alias (str): The alias that should point to the given index.
index (int): The index of the dataset for which an alias should be added.
Raises:
DataInvalidIndex: If the... | [
"Add",
"an",
"alias",
"pointing",
"to",
"the",
"specified",
"index",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_data.py#L165-L177 | [
"def",
"add_alias",
"(",
"self",
",",
"alias",
",",
"index",
")",
":",
"if",
"index",
">=",
"len",
"(",
"self",
".",
"_datasets",
")",
":",
"raise",
"DataInvalidIndex",
"(",
"'A dataset with index {} does not exist'",
".",
"format",
"(",
"index",
")",
")",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | MultiTaskData.flatten | Merge all datasets into a single dataset.
The default dataset is the last dataset to be merged, as it is considered to be
the primary source of information and should overwrite all existing fields with
the same key.
Args:
in_place (bool): Set to ``True`` to replace the exis... | lightflow/models/task_data.py | def flatten(self, in_place=True):
""" Merge all datasets into a single dataset.
The default dataset is the last dataset to be merged, as it is considered to be
the primary source of information and should overwrite all existing fields with
the same key.
Args:
in_pla... | def flatten(self, in_place=True):
""" Merge all datasets into a single dataset.
The default dataset is the last dataset to be merged, as it is considered to be
the primary source of information and should overwrite all existing fields with
the same key.
Args:
in_pla... | [
"Merge",
"all",
"datasets",
"into",
"a",
"single",
"dataset",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_data.py#L179-L211 | [
"def",
"flatten",
"(",
"self",
",",
"in_place",
"=",
"True",
")",
":",
"new_dataset",
"=",
"TaskData",
"(",
")",
"for",
"i",
",",
"dataset",
"in",
"enumerate",
"(",
"self",
".",
"_datasets",
")",
":",
"if",
"i",
"!=",
"self",
".",
"_default_index",
"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | MultiTaskData.set_default_by_alias | Set the default dataset by its alias.
After changing the default dataset, all calls without explicitly specifying the
dataset by index or alias will be redirected to this dataset.
Args:
alias (str): The alias of the dataset that should be made the default.
Raises:
... | lightflow/models/task_data.py | def set_default_by_alias(self, alias):
""" Set the default dataset by its alias.
After changing the default dataset, all calls without explicitly specifying the
dataset by index or alias will be redirected to this dataset.
Args:
alias (str): The alias of the dataset that sh... | def set_default_by_alias(self, alias):
""" Set the default dataset by its alias.
After changing the default dataset, all calls without explicitly specifying the
dataset by index or alias will be redirected to this dataset.
Args:
alias (str): The alias of the dataset that sh... | [
"Set",
"the",
"default",
"dataset",
"by",
"its",
"alias",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_data.py#L213-L228 | [
"def",
"set_default_by_alias",
"(",
"self",
",",
"alias",
")",
":",
"if",
"alias",
"not",
"in",
"self",
".",
"_aliases",
":",
"raise",
"DataInvalidAlias",
"(",
"'A dataset with alias {} does not exist'",
".",
"format",
"(",
"alias",
")",
")",
"self",
".",
"_de... | dc53dbc1d961e20fb144273baca258060705c03e |
train | MultiTaskData.set_default_by_index | Set the default dataset by its index.
After changing the default dataset, all calls without explicitly specifying the
dataset by index or alias will be redirected to this dataset.
Args:
index (int): The index of the dataset that should be made the default.
Raises:
... | lightflow/models/task_data.py | def set_default_by_index(self, index):
""" Set the default dataset by its index.
After changing the default dataset, all calls without explicitly specifying the
dataset by index or alias will be redirected to this dataset.
Args:
index (int): The index of the dataset that sh... | def set_default_by_index(self, index):
""" Set the default dataset by its index.
After changing the default dataset, all calls without explicitly specifying the
dataset by index or alias will be redirected to this dataset.
Args:
index (int): The index of the dataset that sh... | [
"Set",
"the",
"default",
"dataset",
"by",
"its",
"index",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_data.py#L230-L245 | [
"def",
"set_default_by_index",
"(",
"self",
",",
"index",
")",
":",
"if",
"index",
">=",
"len",
"(",
"self",
".",
"_datasets",
")",
":",
"raise",
"DataInvalidIndex",
"(",
"'A dataset with index {} does not exist'",
".",
"format",
"(",
"index",
")",
")",
"self"... | dc53dbc1d961e20fb144273baca258060705c03e |
train | MultiTaskData.get_by_alias | Return a dataset by its alias.
Args:
alias (str): The alias of the dataset that should be returned.
Raises:
DataInvalidAlias: If the alias does not represent a valid dataset. | lightflow/models/task_data.py | def get_by_alias(self, alias):
""" Return a dataset by its alias.
Args:
alias (str): The alias of the dataset that should be returned.
Raises:
DataInvalidAlias: If the alias does not represent a valid dataset.
"""
if alias not in self._aliases:
... | def get_by_alias(self, alias):
""" Return a dataset by its alias.
Args:
alias (str): The alias of the dataset that should be returned.
Raises:
DataInvalidAlias: If the alias does not represent a valid dataset.
"""
if alias not in self._aliases:
... | [
"Return",
"a",
"dataset",
"by",
"its",
"alias",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_data.py#L247-L259 | [
"def",
"get_by_alias",
"(",
"self",
",",
"alias",
")",
":",
"if",
"alias",
"not",
"in",
"self",
".",
"_aliases",
":",
"raise",
"DataInvalidAlias",
"(",
"'A dataset with alias {} does not exist'",
".",
"format",
"(",
"alias",
")",
")",
"return",
"self",
".",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | MultiTaskData.get_by_index | Return a dataset by its index.
Args:
index (int): The index of the dataset that should be returned.
Raises:
DataInvalidIndex: If the index does not represent a valid dataset. | lightflow/models/task_data.py | def get_by_index(self, index):
""" Return a dataset by its index.
Args:
index (int): The index of the dataset that should be returned.
Raises:
DataInvalidIndex: If the index does not represent a valid dataset.
"""
if index >= len(self._datasets):
... | def get_by_index(self, index):
""" Return a dataset by its index.
Args:
index (int): The index of the dataset that should be returned.
Raises:
DataInvalidIndex: If the index does not represent a valid dataset.
"""
if index >= len(self._datasets):
... | [
"Return",
"a",
"dataset",
"by",
"its",
"index",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_data.py#L261-L273 | [
"def",
"get_by_index",
"(",
"self",
",",
"index",
")",
":",
"if",
"index",
">=",
"len",
"(",
"self",
".",
"_datasets",
")",
":",
"raise",
"DataInvalidIndex",
"(",
"'A dataset with index {} does not exist'",
".",
"format",
"(",
"index",
")",
")",
"return",
"s... | dc53dbc1d961e20fb144273baca258060705c03e |
train | PythonTask.run | The main run method of the Python task.
Args:
data (:class:`.MultiTaskData`): The data object that has been passed from the
predecessor task.
store (:class:`.DataStoreDocument`): The persistent data store object that allows the
task to store data for acce... | lightflow/tasks/python_task.py | def run(self, data, store, signal, context, **kwargs):
""" The main run method of the Python task.
Args:
data (:class:`.MultiTaskData`): The data object that has been passed from the
predecessor task.
store (:class:`.DataStoreDocument`): The persistent data store... | def run(self, data, store, signal, context, **kwargs):
""" The main run method of the Python task.
Args:
data (:class:`.MultiTaskData`): The data object that has been passed from the
predecessor task.
store (:class:`.DataStoreDocument`): The persistent data store... | [
"The",
"main",
"run",
"method",
"of",
"the",
"Python",
"task",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/tasks/python_task.py#L80-L99 | [
"def",
"run",
"(",
"self",
",",
"data",
",",
"store",
",",
"signal",
",",
"context",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_callback",
"is",
"not",
"None",
":",
"result",
"=",
"self",
".",
"_callback",
"(",
"data",
",",
"store",
... | dc53dbc1d961e20fb144273baca258060705c03e |
train | TaskContext.to_dict | Return the task context content as a dictionary. | lightflow/models/task_context.py | def to_dict(self):
""" Return the task context content as a dictionary. """
return {
'task_name': self.task_name,
'dag_name': self.dag_name,
'workflow_name': self.workflow_name,
'workflow_id': self.workflow_id,
'worker_hostname': self.worker_ho... | def to_dict(self):
""" Return the task context content as a dictionary. """
return {
'task_name': self.task_name,
'dag_name': self.dag_name,
'workflow_name': self.workflow_name,
'workflow_id': self.workflow_id,
'worker_hostname': self.worker_ho... | [
"Return",
"the",
"task",
"context",
"content",
"as",
"a",
"dictionary",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_context.py#L21-L29 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"return",
"{",
"'task_name'",
":",
"self",
".",
"task_name",
",",
"'dag_name'",
":",
"self",
".",
"dag_name",
",",
"'workflow_name'",
":",
"self",
".",
"workflow_name",
",",
"'workflow_id'",
":",
"self",
".",
"workf... | dc53dbc1d961e20fb144273baca258060705c03e |
train | start_worker | Start a worker process.
Args:
queues (list): List of queue names this worker accepts jobs from.
config (Config): Reference to the configuration object from which the
settings for the worker are retrieved.
name (string): Unique name for the worker. The hostname template variables... | lightflow/workers.py | def start_worker(queues, config, *, name=None, celery_args=None, check_datastore=True):
""" Start a worker process.
Args:
queues (list): List of queue names this worker accepts jobs from.
config (Config): Reference to the configuration object from which the
settings for the worker a... | def start_worker(queues, config, *, name=None, celery_args=None, check_datastore=True):
""" Start a worker process.
Args:
queues (list): List of queue names this worker accepts jobs from.
config (Config): Reference to the configuration object from which the
settings for the worker a... | [
"Start",
"a",
"worker",
"process",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/workers.py#L10-L42 | [
"def",
"start_worker",
"(",
"queues",
",",
"config",
",",
"*",
",",
"name",
"=",
"None",
",",
"celery_args",
"=",
"None",
",",
"check_datastore",
"=",
"True",
")",
":",
"celery_app",
"=",
"create_app",
"(",
"config",
")",
"if",
"check_datastore",
":",
"w... | dc53dbc1d961e20fb144273baca258060705c03e |
train | stop_worker | Stop a worker process.
Args:
config (Config): Reference to the configuration object from which the
settings for the worker are retrieved.
worker_ids (list): An optional list of ids for the worker that should be stopped. | lightflow/workers.py | def stop_worker(config, *, worker_ids=None):
""" Stop a worker process.
Args:
config (Config): Reference to the configuration object from which the
settings for the worker are retrieved.
worker_ids (list): An optional list of ids for the worker that should be stopped.
"""
if... | def stop_worker(config, *, worker_ids=None):
""" Stop a worker process.
Args:
config (Config): Reference to the configuration object from which the
settings for the worker are retrieved.
worker_ids (list): An optional list of ids for the worker that should be stopped.
"""
if... | [
"Stop",
"a",
"worker",
"process",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/workers.py#L45-L57 | [
"def",
"stop_worker",
"(",
"config",
",",
"*",
",",
"worker_ids",
"=",
"None",
")",
":",
"if",
"worker_ids",
"is",
"not",
"None",
"and",
"not",
"isinstance",
"(",
"worker_ids",
",",
"list",
")",
":",
"worker_ids",
"=",
"[",
"worker_ids",
"]",
"celery_app... | dc53dbc1d961e20fb144273baca258060705c03e |
train | list_workers | Return a list of all available workers.
Args:
config (Config): Reference to the configuration object from which the
settings are retrieved.
filter_by_queues (list): Restrict the returned workers to workers that listen to
at least one of the queue names in this list.
Ret... | lightflow/workers.py | def list_workers(config, *, filter_by_queues=None):
""" Return a list of all available workers.
Args:
config (Config): Reference to the configuration object from which the
settings are retrieved.
filter_by_queues (list): Restrict the returned workers to workers that listen to
... | def list_workers(config, *, filter_by_queues=None):
""" Return a list of all available workers.
Args:
config (Config): Reference to the configuration object from which the
settings are retrieved.
filter_by_queues (list): Restrict the returned workers to workers that listen to
... | [
"Return",
"a",
"list",
"of",
"all",
"available",
"workers",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/workers.py#L60-L93 | [
"def",
"list_workers",
"(",
"config",
",",
"*",
",",
"filter_by_queues",
"=",
"None",
")",
":",
"celery_app",
"=",
"create_app",
"(",
"config",
")",
"worker_stats",
"=",
"celery_app",
".",
"control",
".",
"inspect",
"(",
")",
".",
"stats",
"(",
")",
"que... | dc53dbc1d961e20fb144273baca258060705c03e |
train | TaskParameters.eval | Return a new object in which callable parameters have been evaluated.
Native types are not touched and simply returned, while callable methods are
executed and their return value is returned.
Args:
data (MultiTaskData): The data object that has been passed from the
... | lightflow/models/task_parameters.py | def eval(self, data, data_store, *, exclude=None):
""" Return a new object in which callable parameters have been evaluated.
Native types are not touched and simply returned, while callable methods are
executed and their return value is returned.
Args:
data (MultiTaskData):... | def eval(self, data, data_store, *, exclude=None):
""" Return a new object in which callable parameters have been evaluated.
Native types are not touched and simply returned, while callable methods are
executed and their return value is returned.
Args:
data (MultiTaskData):... | [
"Return",
"a",
"new",
"object",
"in",
"which",
"callable",
"parameters",
"have",
"been",
"evaluated",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_parameters.py#L60-L90 | [
"def",
"eval",
"(",
"self",
",",
"data",
",",
"data_store",
",",
"*",
",",
"exclude",
"=",
"None",
")",
":",
"exclude",
"=",
"[",
"]",
"if",
"exclude",
"is",
"None",
"else",
"exclude",
"result",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"s... | dc53dbc1d961e20fb144273baca258060705c03e |
train | TaskParameters.eval_single | Evaluate the value of a single parameter taking into account callables .
Native types are not touched and simply returned, while callable methods are
executed and their return value is returned.
Args:
key (str): The name of the parameter that should be evaluated.
data (... | lightflow/models/task_parameters.py | def eval_single(self, key, data, data_store):
""" Evaluate the value of a single parameter taking into account callables .
Native types are not touched and simply returned, while callable methods are
executed and their return value is returned.
Args:
key (str): The name of ... | def eval_single(self, key, data, data_store):
""" Evaluate the value of a single parameter taking into account callables .
Native types are not touched and simply returned, while callable methods are
executed and their return value is returned.
Args:
key (str): The name of ... | [
"Evaluate",
"the",
"value",
"of",
"a",
"single",
"parameter",
"taking",
"into",
"account",
"callables",
"."
] | AustralianSynchrotron/lightflow | python | https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_parameters.py#L92-L114 | [
"def",
"eval_single",
"(",
"self",
",",
"key",
",",
"data",
",",
"data_store",
")",
":",
"if",
"key",
"in",
"self",
":",
"value",
"=",
"self",
"[",
"key",
"]",
"if",
"value",
"is",
"not",
"None",
"and",
"callable",
"(",
"value",
")",
":",
"return",... | dc53dbc1d961e20fb144273baca258060705c03e |
train | get_lotw_users | Download the latest offical list of `ARRL Logbook of the World (LOTW)`__ users.
Args:
url (str, optional): Download URL
Returns:
dict: Dictionary containing the callsign (unicode) date of the last LOTW upload (datetime)
Raises:
IOError: When network is unav... | pyhamtools/qsl.py | def get_lotw_users(**kwargs):
"""Download the latest offical list of `ARRL Logbook of the World (LOTW)`__ users.
Args:
url (str, optional): Download URL
Returns:
dict: Dictionary containing the callsign (unicode) date of the last LOTW upload (datetime)
Raises:
... | def get_lotw_users(**kwargs):
"""Download the latest offical list of `ARRL Logbook of the World (LOTW)`__ users.
Args:
url (str, optional): Download URL
Returns:
dict: Dictionary containing the callsign (unicode) date of the last LOTW upload (datetime)
Raises:
... | [
"Download",
"the",
"latest",
"offical",
"list",
"of",
"ARRL",
"Logbook",
"of",
"the",
"World",
"(",
"LOTW",
")",
"__",
"users",
"."
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/qsl.py#L12-L69 | [
"def",
"get_lotw_users",
"(",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"\"\"",
"lotw",
"=",
"{",
"}",
"try",
":",
"url",
"=",
"kwargs",
"[",
"'url'",
"]",
"except",
"KeyError",
":",
"# url = \"http://wd5eae.org/LoTW_Data.txt\"",
"url",
"=",
"\"https://lotw.... | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | get_clublog_users | Download the latest offical list of `Clublog`__ users.
Args:
url (str, optional): Download URL
Returns:
dict: Dictionary containing (if data available) the fields:
firstqso, lastqso, last-lotw, lastupload (datetime),
locator (string) and oqrs (bo... | pyhamtools/qsl.py | def get_clublog_users(**kwargs):
"""Download the latest offical list of `Clublog`__ users.
Args:
url (str, optional): Download URL
Returns:
dict: Dictionary containing (if data available) the fields:
firstqso, lastqso, last-lotw, lastupload (datetime),
... | def get_clublog_users(**kwargs):
"""Download the latest offical list of `Clublog`__ users.
Args:
url (str, optional): Download URL
Returns:
dict: Dictionary containing (if data available) the fields:
firstqso, lastqso, last-lotw, lastupload (datetime),
... | [
"Download",
"the",
"latest",
"offical",
"list",
"of",
"Clublog",
"__",
"users",
"."
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/qsl.py#L71-L157 | [
"def",
"get_clublog_users",
"(",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"\"\"",
"clublog",
"=",
"{",
"}",
"try",
":",
"url",
"=",
"kwargs",
"[",
"'url'",
"]",
"except",
"KeyError",
":",
"url",
"=",
"\"https://secure.clublog.org/clublog-users.json.zip\"",
... | ee7e4b8732e23c298da10e07163748156c16d0fa |
train | get_eqsl_users | Download the latest official list of `EQSL.cc`__ users. The list of users can be found here_.
Args:
url (str, optional): Download URL
Returns:
list: List containing the callsigns of EQSL users (unicode)
Raises:
IOError: When network is unavailable, file can... | pyhamtools/qsl.py | def get_eqsl_users(**kwargs):
"""Download the latest official list of `EQSL.cc`__ users. The list of users can be found here_.
Args:
url (str, optional): Download URL
Returns:
list: List containing the callsigns of EQSL users (unicode)
Raises:
IOError: ... | def get_eqsl_users(**kwargs):
"""Download the latest official list of `EQSL.cc`__ users. The list of users can be found here_.
Args:
url (str, optional): Download URL
Returns:
list: List containing the callsigns of EQSL users (unicode)
Raises:
IOError: ... | [
"Download",
"the",
"latest",
"official",
"list",
"of",
"EQSL",
".",
"cc",
"__",
"users",
".",
"The",
"list",
"of",
"users",
"can",
"be",
"found",
"here_",
"."
] | dh1tw/pyhamtools | python | https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/qsl.py#L159-L206 | [
"def",
"get_eqsl_users",
"(",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"\"\"",
"eqsl",
"=",
"[",
"]",
"try",
":",
"url",
"=",
"kwargs",
"[",
"'url'",
"]",
"except",
"KeyError",
":",
"url",
"=",
"\"http://www.eqsl.cc/QSLCard/DownloadedFiles/AGMemberlist.txt\""... | ee7e4b8732e23c298da10e07163748156c16d0fa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.