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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | get_enrich | Execute the enrich phase for a given backend section
:param config: a Mordred config object
:param backend_section: the backend section where the enrich phase is executed | utils/micro.py | def get_enrich(config, backend_section):
"""Execute the enrich phase for a given backend section
:param config: a Mordred config object
:param backend_section: the backend section where the enrich phase is executed
"""
TaskProjects(config).execute()
task = TaskEnrich(config, backend_section=ba... | def get_enrich(config, backend_section):
"""Execute the enrich phase for a given backend section
:param config: a Mordred config object
:param backend_section: the backend section where the enrich phase is executed
"""
TaskProjects(config).execute()
task = TaskEnrich(config, backend_section=ba... | [
"Execute",
"the",
"enrich",
"phase",
"for",
"a",
"given",
"backend",
"section"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/utils/micro.py#L104-L118 | [
"def",
"get_enrich",
"(",
"config",
",",
"backend_section",
")",
":",
"TaskProjects",
"(",
"config",
")",
".",
"execute",
"(",
")",
"task",
"=",
"TaskEnrich",
"(",
"config",
",",
"backend_section",
"=",
"backend_section",
")",
"try",
":",
"task",
".",
"exe... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | get_panels | Execute the panels phase
:param config: a Mordred config object | utils/micro.py | def get_panels(config):
"""Execute the panels phase
:param config: a Mordred config object
"""
task = TaskPanels(config)
task.execute()
task = TaskPanelsMenu(config)
task.execute()
logging.info("Panels creation finished!") | def get_panels(config):
"""Execute the panels phase
:param config: a Mordred config object
"""
task = TaskPanels(config)
task.execute()
task = TaskPanelsMenu(config)
task.execute()
logging.info("Panels creation finished!") | [
"Execute",
"the",
"panels",
"phase"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/utils/micro.py#L121-L133 | [
"def",
"get_panels",
"(",
"config",
")",
":",
"task",
"=",
"TaskPanels",
"(",
"config",
")",
"task",
".",
"execute",
"(",
")",
"task",
"=",
"TaskPanelsMenu",
"(",
"config",
")",
"task",
".",
"execute",
"(",
")",
"logging",
".",
"info",
"(",
"\"Panels c... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | config_logging | Config logging level output output | utils/micro.py | def config_logging(debug):
"""Config logging level output output"""
if debug:
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s')
logging.debug("Debug mode activated")
else:
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s') | def config_logging(debug):
"""Config logging level output output"""
if debug:
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s')
logging.debug("Debug mode activated")
else:
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s') | [
"Config",
"logging",
"level",
"output",
"output"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/utils/micro.py#L136-L143 | [
"def",
"config_logging",
"(",
"debug",
")",
":",
"if",
"debug",
":",
"logging",
".",
"basicConfig",
"(",
"level",
"=",
"logging",
".",
"DEBUG",
",",
"format",
"=",
"'%(asctime)s %(message)s'",
")",
"logging",
".",
"debug",
"(",
"\"Debug mode activated\"",
")",... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | get_params_parser | Parse command line arguments | utils/micro.py | def get_params_parser():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('-g', '--debug', dest='debug',
action='store_true',
help=argparse.SUPPRESS)
parser.add_argument("--arthur", action='store_tru... | def get_params_parser():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('-g', '--debug', dest='debug',
action='store_true',
help=argparse.SUPPRESS)
parser.add_argument("--arthur", action='store_tru... | [
"Parse",
"command",
"line",
"arguments"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/utils/micro.py#L146-L174 | [
"def",
"get_params_parser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"add_help",
"=",
"False",
")",
"parser",
".",
"add_argument",
"(",
"'-g'",
",",
"'--debug'",
",",
"dest",
"=",
"'debug'",
",",
"action",
"=",
"'store_true'",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | get_params | Get params to execute the micro-mordred | utils/micro.py | def get_params():
"""Get params to execute the micro-mordred"""
parser = get_params_parser()
args = parser.parse_args()
if not args.raw and not args.enrich and not args.identities and not args.panels:
print("No tasks enabled")
sys.exit(1)
return args | def get_params():
"""Get params to execute the micro-mordred"""
parser = get_params_parser()
args = parser.parse_args()
if not args.raw and not args.enrich and not args.identities and not args.panels:
print("No tasks enabled")
sys.exit(1)
return args | [
"Get",
"params",
"to",
"execute",
"the",
"micro",
"-",
"mordred"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/utils/micro.py#L177-L187 | [
"def",
"get_params",
"(",
")",
":",
"parser",
"=",
"get_params_parser",
"(",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"if",
"not",
"args",
".",
"raw",
"and",
"not",
"args",
".",
"enrich",
"and",
"not",
"args",
".",
"identities",
"and",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskPanels.__kibiter_version | Get the kibiter vesion.
:param major: major Elasticsearch version | sirmordred/task_panels.py | def __kibiter_version(self):
""" Get the kibiter vesion.
:param major: major Elasticsearch version
"""
version = None
es_url = self.conf['es_enrichment']['url']
config_url = '.kibana/config/_search'
url = urijoin(es_url, config_url)
version = None
... | def __kibiter_version(self):
""" Get the kibiter vesion.
:param major: major Elasticsearch version
"""
version = None
es_url = self.conf['es_enrichment']['url']
config_url = '.kibana/config/_search'
url = urijoin(es_url, config_url)
version = None
... | [
"Get",
"the",
"kibiter",
"vesion",
"."
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_panels.py#L232-L251 | [
"def",
"__kibiter_version",
"(",
"self",
")",
":",
"version",
"=",
"None",
"es_url",
"=",
"self",
".",
"conf",
"[",
"'es_enrichment'",
"]",
"[",
"'url'",
"]",
"config_url",
"=",
"'.kibana/config/_search'",
"url",
"=",
"urijoin",
"(",
"es_url",
",",
"config_u... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskPanels.create_dashboard | Upload a panel to Elasticsearch if it does not exist yet.
If a list of data sources is specified, upload only those
elements (visualizations, searches) that match that data source.
:param panel_file: file name of panel (dashobard) to upload
:param data_sources: list of data sources
... | sirmordred/task_panels.py | def create_dashboard(self, panel_file, data_sources=None, strict=True):
"""Upload a panel to Elasticsearch if it does not exist yet.
If a list of data sources is specified, upload only those
elements (visualizations, searches) that match that data source.
:param panel_file: file name o... | def create_dashboard(self, panel_file, data_sources=None, strict=True):
"""Upload a panel to Elasticsearch if it does not exist yet.
If a list of data sources is specified, upload only those
elements (visualizations, searches) that match that data source.
:param panel_file: file name o... | [
"Upload",
"a",
"panel",
"to",
"Elasticsearch",
"if",
"it",
"does",
"not",
"exist",
"yet",
"."
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_panels.py#L338-L374 | [
"def",
"create_dashboard",
"(",
"self",
",",
"panel_file",
",",
"data_sources",
"=",
"None",
",",
"strict",
"=",
"True",
")",
":",
"es_enrich",
"=",
"self",
".",
"conf",
"[",
"'es_enrichment'",
"]",
"[",
"'url'",
"]",
"kibana_url",
"=",
"self",
".",
"con... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskPanelsMenu.__upload_title | Upload to Kibiter the title for the dashboard.
The title is shown on top of the dashboard menu, and is Usually
the name of the project being dashboarded.
This is done only for Kibiter 6.x.
:param kibiter_major: major version of kibiter | sirmordred/task_panels.py | def __upload_title(self, kibiter_major):
"""Upload to Kibiter the title for the dashboard.
The title is shown on top of the dashboard menu, and is Usually
the name of the project being dashboarded.
This is done only for Kibiter 6.x.
:param kibiter_major: major version of kibite... | def __upload_title(self, kibiter_major):
"""Upload to Kibiter the title for the dashboard.
The title is shown on top of the dashboard menu, and is Usually
the name of the project being dashboarded.
This is done only for Kibiter 6.x.
:param kibiter_major: major version of kibite... | [
"Upload",
"to",
"Kibiter",
"the",
"title",
"for",
"the",
"dashboard",
"."
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_panels.py#L481-L517 | [
"def",
"__upload_title",
"(",
"self",
",",
"kibiter_major",
")",
":",
"if",
"kibiter_major",
"==",
"\"6\"",
":",
"resource",
"=",
"\".kibana/doc/projectname\"",
"data",
"=",
"{",
"\"projectname\"",
":",
"{",
"\"name\"",
":",
"self",
".",
"project_name",
"}",
"... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskPanelsMenu.__create_dashboard_menu | Create the menu definition to access the panels in a dashboard.
:param menu: dashboard menu to upload
:param kibiter_major: major version of kibiter | sirmordred/task_panels.py | def __create_dashboard_menu(self, dash_menu, kibiter_major):
"""Create the menu definition to access the panels in a dashboard.
:param menu: dashboard menu to upload
:param kibiter_major: major version of kibiter
"""
logger.info("Adding dashboard menu")
if kibit... | def __create_dashboard_menu(self, dash_menu, kibiter_major):
"""Create the menu definition to access the panels in a dashboard.
:param menu: dashboard menu to upload
:param kibiter_major: major version of kibiter
"""
logger.info("Adding dashboard menu")
if kibit... | [
"Create",
"the",
"menu",
"definition",
"to",
"access",
"the",
"panels",
"in",
"a",
"dashboard",
"."
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_panels.py#L519-L555 | [
"def",
"__create_dashboard_menu",
"(",
"self",
",",
"dash_menu",
",",
"kibiter_major",
")",
":",
"logger",
".",
"info",
"(",
"\"Adding dashboard menu\"",
")",
"if",
"kibiter_major",
"==",
"\"6\"",
":",
"menu_resource",
"=",
"\".kibana/doc/metadashboard\"",
"mapping_re... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskPanelsMenu.__remove_dashboard_menu | Remove existing menu for dashboard, if any.
Usually, we remove the menu before creating a new one.
:param kibiter_major: major version of kibiter | sirmordred/task_panels.py | def __remove_dashboard_menu(self, kibiter_major):
"""Remove existing menu for dashboard, if any.
Usually, we remove the menu before creating a new one.
:param kibiter_major: major version of kibiter
"""
logger.info("Removing old dashboard menu, if any")
if kibiter_major... | def __remove_dashboard_menu(self, kibiter_major):
"""Remove existing menu for dashboard, if any.
Usually, we remove the menu before creating a new one.
:param kibiter_major: major version of kibiter
"""
logger.info("Removing old dashboard menu, if any")
if kibiter_major... | [
"Remove",
"existing",
"menu",
"for",
"dashboard",
"if",
"any",
"."
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_panels.py#L557-L570 | [
"def",
"__remove_dashboard_menu",
"(",
"self",
",",
"kibiter_major",
")",
":",
"logger",
".",
"info",
"(",
"\"Removing old dashboard menu, if any\"",
")",
"if",
"kibiter_major",
"==",
"\"6\"",
":",
"metadashboard",
"=",
"\".kibana/doc/metadashboard\"",
"else",
":",
"m... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskPanelsMenu.__get_menu_entries | Get the menu entries from the panel definition | sirmordred/task_panels.py | def __get_menu_entries(self, kibiter_major):
""" Get the menu entries from the panel definition """
menu_entries = []
for entry in self.panels_menu:
if entry['source'] not in self.data_sources:
continue
parent_menu_item = {
'name': entry['n... | def __get_menu_entries(self, kibiter_major):
""" Get the menu entries from the panel definition """
menu_entries = []
for entry in self.panels_menu:
if entry['source'] not in self.data_sources:
continue
parent_menu_item = {
'name': entry['n... | [
"Get",
"the",
"menu",
"entries",
"from",
"the",
"panel",
"definition"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_panels.py#L572-L602 | [
"def",
"__get_menu_entries",
"(",
"self",
",",
"kibiter_major",
")",
":",
"menu_entries",
"=",
"[",
"]",
"for",
"entry",
"in",
"self",
".",
"panels_menu",
":",
"if",
"entry",
"[",
"'source'",
"]",
"not",
"in",
"self",
".",
"data_sources",
":",
"continue",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskPanelsMenu.__get_dash_menu | Order the dashboard menu | sirmordred/task_panels.py | def __get_dash_menu(self, kibiter_major):
"""Order the dashboard menu"""
# omenu = OrderedDict()
omenu = []
# Start with Overview
omenu.append(self.menu_panels_common['Overview'])
# Now the data _getsources
ds_menu = self.__get_menu_entries(kibiter_major)
... | def __get_dash_menu(self, kibiter_major):
"""Order the dashboard menu"""
# omenu = OrderedDict()
omenu = []
# Start with Overview
omenu.append(self.menu_panels_common['Overview'])
# Now the data _getsources
ds_menu = self.__get_menu_entries(kibiter_major)
... | [
"Order",
"the",
"dashboard",
"menu"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_panels.py#L604-L642 | [
"def",
"__get_dash_menu",
"(",
"self",
",",
"kibiter_major",
")",
":",
"# omenu = OrderedDict()",
"omenu",
"=",
"[",
"]",
"# Start with Overview",
"omenu",
".",
"append",
"(",
"self",
".",
"menu_panels_common",
"[",
"'Overview'",
"]",
")",
"# Now the data _getsource... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | compose_mbox | Compose projects.json only for mbox, but using the mailing_lists lists
change: 'https://dev.eclipse.org/mailman/listinfo/emft-dev'
to: 'emfg-dev /home/bitergia/mboxes/emft-dev.mbox/emft-dev.mbox
:param projects: projects.json
:return: projects.json with mbox | sirmordred/eclipse_projects_lib.py | def compose_mbox(projects):
""" Compose projects.json only for mbox, but using the mailing_lists lists
change: 'https://dev.eclipse.org/mailman/listinfo/emft-dev'
to: 'emfg-dev /home/bitergia/mboxes/emft-dev.mbox/emft-dev.mbox
:param projects: projects.json
:return: projects.json with mbox
"""... | def compose_mbox(projects):
""" Compose projects.json only for mbox, but using the mailing_lists lists
change: 'https://dev.eclipse.org/mailman/listinfo/emft-dev'
to: 'emfg-dev /home/bitergia/mboxes/emft-dev.mbox/emft-dev.mbox
:param projects: projects.json
:return: projects.json with mbox
"""... | [
"Compose",
"projects",
".",
"json",
"only",
"for",
"mbox",
"but",
"using",
"the",
"mailing_lists",
"lists"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L27-L52 | [
"def",
"compose_mbox",
"(",
"projects",
")",
":",
"mbox_archives",
"=",
"'/home/bitergia/mboxes'",
"mailing_lists_projects",
"=",
"[",
"project",
"for",
"project",
"in",
"projects",
"if",
"'mailing_lists'",
"in",
"projects",
"[",
"project",
"]",
"]",
"for",
"maili... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | compose_gerrit | Compose projects.json for gerrit, but using the git lists
change: 'http://git.eclipse.org/gitroot/xwt/org.eclipse.xwt.git'
to: 'git.eclipse.org_xwt/org.eclipse.xwt
:param projects: projects.json
:return: projects.json with gerrit | sirmordred/eclipse_projects_lib.py | def compose_gerrit(projects):
""" Compose projects.json for gerrit, but using the git lists
change: 'http://git.eclipse.org/gitroot/xwt/org.eclipse.xwt.git'
to: 'git.eclipse.org_xwt/org.eclipse.xwt
:param projects: projects.json
:return: projects.json with gerrit
"""
git_projects = [projec... | def compose_gerrit(projects):
""" Compose projects.json for gerrit, but using the git lists
change: 'http://git.eclipse.org/gitroot/xwt/org.eclipse.xwt.git'
to: 'git.eclipse.org_xwt/org.eclipse.xwt
:param projects: projects.json
:return: projects.json with gerrit
"""
git_projects = [projec... | [
"Compose",
"projects",
".",
"json",
"for",
"gerrit",
"but",
"using",
"the",
"git",
"lists"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L55-L74 | [
"def",
"compose_gerrit",
"(",
"projects",
")",
":",
"git_projects",
"=",
"[",
"project",
"for",
"project",
"in",
"projects",
"if",
"'git'",
"in",
"projects",
"[",
"project",
"]",
"]",
"for",
"project",
"in",
"git_projects",
":",
"repos",
"=",
"[",
"repo",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | compose_git | Compose projects.json for git
We need to replace '/c/' by '/gitroot/' for instance
change: 'http://git.eclipse.org/c/xwt/org.eclipse.xwt.git'
to: 'http://git.eclipse.org/gitroot/xwt/org.eclipse.xwt.git'
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with git | sirmordred/eclipse_projects_lib.py | def compose_git(projects, data):
""" Compose projects.json for git
We need to replace '/c/' by '/gitroot/' for instance
change: 'http://git.eclipse.org/c/xwt/org.eclipse.xwt.git'
to: 'http://git.eclipse.org/gitroot/xwt/org.eclipse.xwt.git'
:param projects: projects.json
:param data: eclipse J... | def compose_git(projects, data):
""" Compose projects.json for git
We need to replace '/c/' by '/gitroot/' for instance
change: 'http://git.eclipse.org/c/xwt/org.eclipse.xwt.git'
to: 'http://git.eclipse.org/gitroot/xwt/org.eclipse.xwt.git'
:param projects: projects.json
:param data: eclipse J... | [
"Compose",
"projects",
".",
"json",
"for",
"git"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L77-L102 | [
"def",
"compose_git",
"(",
"projects",
",",
"data",
")",
":",
"for",
"p",
"in",
"[",
"project",
"for",
"project",
"in",
"data",
"if",
"len",
"(",
"data",
"[",
"project",
"]",
"[",
"'source_repo'",
"]",
")",
">",
"0",
"]",
":",
"repos",
"=",
"[",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | compose_mailing_lists | Compose projects.json for mailing lists
At upstream has two different key for mailing list: 'mailings_lists' and 'dev_list'
The key 'mailing_lists' is an array with mailing lists
The key 'dev_list' is a dict with only one mailing list
:param projects: projects.json
:param data: eclipse JSON
:r... | sirmordred/eclipse_projects_lib.py | def compose_mailing_lists(projects, data):
""" Compose projects.json for mailing lists
At upstream has two different key for mailing list: 'mailings_lists' and 'dev_list'
The key 'mailing_lists' is an array with mailing lists
The key 'dev_list' is a dict with only one mailing list
:param projects:... | def compose_mailing_lists(projects, data):
""" Compose projects.json for mailing lists
At upstream has two different key for mailing list: 'mailings_lists' and 'dev_list'
The key 'mailing_lists' is an array with mailing lists
The key 'dev_list' is a dict with only one mailing list
:param projects:... | [
"Compose",
"projects",
".",
"json",
"for",
"mailing",
"lists"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L105-L131 | [
"def",
"compose_mailing_lists",
"(",
"projects",
",",
"data",
")",
":",
"for",
"p",
"in",
"[",
"project",
"for",
"project",
"in",
"data",
"if",
"len",
"(",
"data",
"[",
"project",
"]",
"[",
"'mailing_lists'",
"]",
")",
">",
"0",
"]",
":",
"if",
"'mai... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | compose_github | Compose projects.json for github
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with github | sirmordred/eclipse_projects_lib.py | def compose_github(projects, data):
""" Compose projects.json for github
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with github
"""
for p in [project for project in data if len(data[project]['github_repos']) > 0]:
if 'github' not in projects[p]:
... | def compose_github(projects, data):
""" Compose projects.json for github
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with github
"""
for p in [project for project in data if len(data[project]['github_repos']) > 0]:
if 'github' not in projects[p]:
... | [
"Compose",
"projects",
".",
"json",
"for",
"github"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L134-L149 | [
"def",
"compose_github",
"(",
"projects",
",",
"data",
")",
":",
"for",
"p",
"in",
"[",
"project",
"for",
"project",
"in",
"data",
"if",
"len",
"(",
"data",
"[",
"project",
"]",
"[",
"'github_repos'",
"]",
")",
">",
"0",
"]",
":",
"if",
"'github'",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | compose_bugzilla | Compose projects.json for bugzilla
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with bugzilla | sirmordred/eclipse_projects_lib.py | def compose_bugzilla(projects, data):
""" Compose projects.json for bugzilla
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with bugzilla
"""
for p in [project for project in data if len(data[project]['bugzilla']) > 0]:
if 'bugzilla' not in projects[p]:
... | def compose_bugzilla(projects, data):
""" Compose projects.json for bugzilla
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with bugzilla
"""
for p in [project for project in data if len(data[project]['bugzilla']) > 0]:
if 'bugzilla' not in projects[p]:
... | [
"Compose",
"projects",
".",
"json",
"for",
"bugzilla"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L152-L167 | [
"def",
"compose_bugzilla",
"(",
"projects",
",",
"data",
")",
":",
"for",
"p",
"in",
"[",
"project",
"for",
"project",
"in",
"data",
"if",
"len",
"(",
"data",
"[",
"project",
"]",
"[",
"'bugzilla'",
"]",
")",
">",
"0",
"]",
":",
"if",
"'bugzilla'",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | compose_title | Compose the projects JSON file only with the projects name
:param projects: projects.json
:param data: eclipse JSON with the origin format
:return: projects.json with titles | sirmordred/eclipse_projects_lib.py | def compose_title(projects, data):
""" Compose the projects JSON file only with the projects name
:param projects: projects.json
:param data: eclipse JSON with the origin format
:return: projects.json with titles
"""
for project in data:
projects[project] = {
'meta': {
... | def compose_title(projects, data):
""" Compose the projects JSON file only with the projects name
:param projects: projects.json
:param data: eclipse JSON with the origin format
:return: projects.json with titles
"""
for project in data:
projects[project] = {
'meta': {
... | [
"Compose",
"the",
"projects",
"JSON",
"file",
"only",
"with",
"the",
"projects",
"name"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L170-L183 | [
"def",
"compose_title",
"(",
"projects",
",",
"data",
")",
":",
"for",
"project",
"in",
"data",
":",
"projects",
"[",
"project",
"]",
"=",
"{",
"'meta'",
":",
"{",
"'title'",
":",
"data",
"[",
"project",
"]",
"[",
"'title'",
"]",
"}",
"}",
"return",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | compose_projects_json | Compose projects.json with all data sources
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with all data sources | sirmordred/eclipse_projects_lib.py | def compose_projects_json(projects, data):
""" Compose projects.json with all data sources
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with all data sources
"""
projects = compose_git(projects, data)
projects = compose_mailing_lists(projects, data)
pr... | def compose_projects_json(projects, data):
""" Compose projects.json with all data sources
:param projects: projects.json
:param data: eclipse JSON
:return: projects.json with all data sources
"""
projects = compose_git(projects, data)
projects = compose_mailing_lists(projects, data)
pr... | [
"Compose",
"projects",
".",
"json",
"with",
"all",
"data",
"sources"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L186-L200 | [
"def",
"compose_projects_json",
"(",
"projects",
",",
"data",
")",
":",
"projects",
"=",
"compose_git",
"(",
"projects",
",",
"data",
")",
"projects",
"=",
"compose_mailing_lists",
"(",
"projects",
",",
"data",
")",
"projects",
"=",
"compose_bugzilla",
"(",
"p... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskEnrich.__autorefresh_studies | Execute autorefresh for areas of code study if configured | sirmordred/task_enrich.py | def __autorefresh_studies(self, cfg):
"""Execute autorefresh for areas of code study if configured"""
if 'studies' not in self.conf[self.backend_section] or \
'enrich_areas_of_code:git' not in self.conf[self.backend_section]['studies']:
logger.debug("Not doing autorefresh fo... | def __autorefresh_studies(self, cfg):
"""Execute autorefresh for areas of code study if configured"""
if 'studies' not in self.conf[self.backend_section] or \
'enrich_areas_of_code:git' not in self.conf[self.backend_section]['studies']:
logger.debug("Not doing autorefresh fo... | [
"Execute",
"autorefresh",
"for",
"areas",
"of",
"code",
"study",
"if",
"configured"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_enrich.py#L268-L302 | [
"def",
"__autorefresh_studies",
"(",
"self",
",",
"cfg",
")",
":",
"if",
"'studies'",
"not",
"in",
"self",
".",
"conf",
"[",
"self",
".",
"backend_section",
"]",
"or",
"'enrich_areas_of_code:git'",
"not",
"in",
"self",
".",
"conf",
"[",
"self",
".",
"backe... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskEnrich.__studies | Execute the studies configured for the current backend | sirmordred/task_enrich.py | def __studies(self, retention_time):
""" Execute the studies configured for the current backend """
cfg = self.config.get_conf()
if 'studies' not in cfg[self.backend_section] or not \
cfg[self.backend_section]['studies']:
logger.debug('No studies for %s' % self.backend_se... | def __studies(self, retention_time):
""" Execute the studies configured for the current backend """
cfg = self.config.get_conf()
if 'studies' not in cfg[self.backend_section] or not \
cfg[self.backend_section]['studies']:
logger.debug('No studies for %s' % self.backend_se... | [
"Execute",
"the",
"studies",
"configured",
"for",
"the",
"current",
"backend"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_enrich.py#L304-L347 | [
"def",
"__studies",
"(",
"self",
",",
"retention_time",
")",
":",
"cfg",
"=",
"self",
".",
"config",
".",
"get_conf",
"(",
")",
"if",
"'studies'",
"not",
"in",
"cfg",
"[",
"self",
".",
"backend_section",
"]",
"or",
"not",
"cfg",
"[",
"self",
".",
"ba... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskEnrich.retain_identities | Retain the identities in SortingHat based on the `retention_time`
value declared in the setup.cfg.
:param retention_time: maximum number of minutes wrt the current date to retain the SortingHat data | sirmordred/task_enrich.py | def retain_identities(self, retention_time):
"""Retain the identities in SortingHat based on the `retention_time`
value declared in the setup.cfg.
:param retention_time: maximum number of minutes wrt the current date to retain the SortingHat data
"""
enrich_es = self.conf['es_en... | def retain_identities(self, retention_time):
"""Retain the identities in SortingHat based on the `retention_time`
value declared in the setup.cfg.
:param retention_time: maximum number of minutes wrt the current date to retain the SortingHat data
"""
enrich_es = self.conf['es_en... | [
"Retain",
"the",
"identities",
"in",
"SortingHat",
"based",
"on",
"the",
"retention_time",
"value",
"declared",
"in",
"the",
"setup",
".",
"cfg",
"."
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_enrich.py#L349-L368 | [
"def",
"retain_identities",
"(",
"self",
",",
"retention_time",
")",
":",
"enrich_es",
"=",
"self",
".",
"conf",
"[",
"'es_enrichment'",
"]",
"[",
"'url'",
"]",
"sortinghat_db",
"=",
"self",
".",
"db",
"current_data_source",
"=",
"self",
".",
"get_backend",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskProjects.get_repos_by_backend_section | return list with the repositories for a backend_section | sirmordred/task_projects.py | def get_repos_by_backend_section(cls, backend_section, raw=True):
""" return list with the repositories for a backend_section """
repos = []
projects = TaskProjects.get_projects()
for pro in projects:
if backend_section in projects[pro]:
# if the projects.jso... | def get_repos_by_backend_section(cls, backend_section, raw=True):
""" return list with the repositories for a backend_section """
repos = []
projects = TaskProjects.get_projects()
for pro in projects:
if backend_section in projects[pro]:
# if the projects.jso... | [
"return",
"list",
"with",
"the",
"repositories",
"for",
"a",
"backend_section"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_projects.py#L71-L126 | [
"def",
"get_repos_by_backend_section",
"(",
"cls",
",",
"backend_section",
",",
"raw",
"=",
"True",
")",
":",
"repos",
"=",
"[",
"]",
"projects",
"=",
"TaskProjects",
".",
"get_projects",
"(",
")",
"for",
"pro",
"in",
"projects",
":",
"if",
"backend_section"... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | TaskProjects.convert_from_eclipse | Convert from eclipse projects format to grimoire projects json format | sirmordred/task_projects.py | def convert_from_eclipse(self, eclipse_projects):
""" Convert from eclipse projects format to grimoire projects json format """
projects = {}
# We need the global project for downloading the full Bugzilla and Gerrit
projects['unknown'] = {
"gerrit": ["git.eclipse.org"],
... | def convert_from_eclipse(self, eclipse_projects):
""" Convert from eclipse projects format to grimoire projects json format """
projects = {}
# We need the global project for downloading the full Bugzilla and Gerrit
projects['unknown'] = {
"gerrit": ["git.eclipse.org"],
... | [
"Convert",
"from",
"eclipse",
"projects",
"format",
"to",
"grimoire",
"projects",
"json",
"format"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_projects.py#L172-L186 | [
"def",
"convert_from_eclipse",
"(",
"self",
",",
"eclipse_projects",
")",
":",
"projects",
"=",
"{",
"}",
"# We need the global project for downloading the full Bugzilla and Gerrit",
"projects",
"[",
"'unknown'",
"]",
"=",
"{",
"\"gerrit\"",
":",
"[",
"\"git.eclipse.org\"... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | Config.general_params | Define all the possible config params | sirmordred/config.py | def general_params(cls):
""" Define all the possible config params """
params = {}
# GENERAL CONFIG
params_general = {
"general": {
"min_update_delay": {
"optional": True,
"default": 60,
"type": int... | def general_params(cls):
""" Define all the possible config params """
params = {}
# GENERAL CONFIG
params_general = {
"general": {
"min_update_delay": {
"optional": True,
"default": 60,
"type": int... | [
"Define",
"all",
"the",
"possible",
"config",
"params"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/config.py#L92-L606 | [
"def",
"general_params",
"(",
"cls",
")",
":",
"params",
"=",
"{",
"}",
"# GENERAL CONFIG",
"params_general",
"=",
"{",
"\"general\"",
":",
"{",
"\"min_update_delay\"",
":",
"{",
"\"optional\"",
":",
"True",
",",
"\"default\"",
":",
"60",
",",
"\"type\"",
":... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | Config.set_param | Change a param in the config | sirmordred/config.py | def set_param(self, section, param, value):
""" Change a param in the config """
if section not in self.conf or param not in self.conf[section]:
logger.error('Config section %s and param %s not exists', section, param)
else:
self.conf[section][param] = value | def set_param(self, section, param, value):
""" Change a param in the config """
if section not in self.conf or param not in self.conf[section]:
logger.error('Config section %s and param %s not exists', section, param)
else:
self.conf[section][param] = value | [
"Change",
"a",
"param",
"in",
"the",
"config"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/config.py#L649-L654 | [
"def",
"set_param",
"(",
"self",
",",
"section",
",",
"param",
",",
"value",
")",
":",
"if",
"section",
"not",
"in",
"self",
".",
"conf",
"or",
"param",
"not",
"in",
"self",
".",
"conf",
"[",
"section",
"]",
":",
"logger",
".",
"error",
"(",
"'Conf... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | Config._add_to_conf | Add new configuration to self.conf.
Adds configuration parameters in new_con to self.conf.
If they already existed in conf, overwrite them.
:param new_conf: new configuration, to add | sirmordred/config.py | def _add_to_conf(self, new_conf):
"""Add new configuration to self.conf.
Adds configuration parameters in new_con to self.conf.
If they already existed in conf, overwrite them.
:param new_conf: new configuration, to add
"""
for section in new_conf:
if secti... | def _add_to_conf(self, new_conf):
"""Add new configuration to self.conf.
Adds configuration parameters in new_con to self.conf.
If they already existed in conf, overwrite them.
:param new_conf: new configuration, to add
"""
for section in new_conf:
if secti... | [
"Add",
"new",
"configuration",
"to",
"self",
".",
"conf",
"."
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/config.py#L782-L796 | [
"def",
"_add_to_conf",
"(",
"self",
",",
"new_conf",
")",
":",
"for",
"section",
"in",
"new_conf",
":",
"if",
"section",
"not",
"in",
"self",
".",
"conf",
":",
"self",
".",
"conf",
"[",
"section",
"]",
"=",
"new_conf",
"[",
"section",
"]",
"else",
":... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | Task.es_version | Get Elasticsearch version.
Get the version of Elasticsearch. This is useful because
Elasticsearch and Kibiter are paired (same major version for 5, 6).
:param url: Elasticseearch url hosting Kibiter indices
:returns: major version, as string | sirmordred/task.py | def es_version(self, url):
"""Get Elasticsearch version.
Get the version of Elasticsearch. This is useful because
Elasticsearch and Kibiter are paired (same major version for 5, 6).
:param url: Elasticseearch url hosting Kibiter indices
:returns: major version, as string
... | def es_version(self, url):
"""Get Elasticsearch version.
Get the version of Elasticsearch. This is useful because
Elasticsearch and Kibiter are paired (same major version for 5, 6).
:param url: Elasticseearch url hosting Kibiter indices
:returns: major version, as string
... | [
"Get",
"Elasticsearch",
"version",
"."
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task.py#L237-L254 | [
"def",
"es_version",
"(",
"self",
",",
"url",
")",
":",
"try",
":",
"res",
"=",
"self",
".",
"grimoire_con",
".",
"get",
"(",
"url",
")",
"res",
".",
"raise_for_status",
"(",
")",
"major",
"=",
"res",
".",
"json",
"(",
")",
"[",
"'version'",
"]",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | SirMordred.execute_nonstop_tasks | Just a wrapper to the execute_batch_tasks method | sirmordred/sirmordred.py | def execute_nonstop_tasks(self, tasks_cls):
"""
Just a wrapper to the execute_batch_tasks method
"""
self.execute_batch_tasks(tasks_cls,
self.conf['sortinghat']['sleep_for'],
self.conf['general']['min_update_delay'], F... | def execute_nonstop_tasks(self, tasks_cls):
"""
Just a wrapper to the execute_batch_tasks method
"""
self.execute_batch_tasks(tasks_cls,
self.conf['sortinghat']['sleep_for'],
self.conf['general']['min_update_delay'], F... | [
"Just",
"a",
"wrapper",
"to",
"the",
"execute_batch_tasks",
"method"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/sirmordred.py#L194-L200 | [
"def",
"execute_nonstop_tasks",
"(",
"self",
",",
"tasks_cls",
")",
":",
"self",
".",
"execute_batch_tasks",
"(",
"tasks_cls",
",",
"self",
".",
"conf",
"[",
"'sortinghat'",
"]",
"[",
"'sleep_for'",
"]",
",",
"self",
".",
"conf",
"[",
"'general'",
"]",
"["... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | SirMordred.execute_batch_tasks | Start a task manager per backend to complete the tasks.
:param task_cls: list of tasks classes to be executed
:param big_delay: seconds before global tasks are executed, should be days usually
:param small_delay: seconds before backend tasks are executed, should be minutes
:param wait_f... | sirmordred/sirmordred.py | def execute_batch_tasks(self, tasks_cls, big_delay=0, small_delay=0, wait_for_threads=True):
"""
Start a task manager per backend to complete the tasks.
:param task_cls: list of tasks classes to be executed
:param big_delay: seconds before global tasks are executed, should be days usual... | def execute_batch_tasks(self, tasks_cls, big_delay=0, small_delay=0, wait_for_threads=True):
"""
Start a task manager per backend to complete the tasks.
:param task_cls: list of tasks classes to be executed
:param big_delay: seconds before global tasks are executed, should be days usual... | [
"Start",
"a",
"task",
"manager",
"per",
"backend",
"to",
"complete",
"the",
"tasks",
"."
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/sirmordred.py#L202-L267 | [
"def",
"execute_batch_tasks",
"(",
"self",
",",
"tasks_cls",
",",
"big_delay",
"=",
"0",
",",
"small_delay",
"=",
"0",
",",
"wait_for_threads",
"=",
"True",
")",
":",
"def",
"_split_tasks",
"(",
"tasks_cls",
")",
":",
"\"\"\"\n we internally distinguish... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | SirMordred.__execute_initial_load | Tasks that should be done just one time | sirmordred/sirmordred.py | def __execute_initial_load(self):
"""
Tasks that should be done just one time
"""
if self.conf['phases']['panels']:
tasks_cls = [TaskPanels, TaskPanelsMenu]
self.execute_tasks(tasks_cls)
if self.conf['phases']['identities']:
tasks_cls = [TaskI... | def __execute_initial_load(self):
"""
Tasks that should be done just one time
"""
if self.conf['phases']['panels']:
tasks_cls = [TaskPanels, TaskPanelsMenu]
self.execute_tasks(tasks_cls)
if self.conf['phases']['identities']:
tasks_cls = [TaskI... | [
"Tasks",
"that",
"should",
"be",
"done",
"just",
"one",
"time"
] | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/sirmordred.py#L280-L297 | [
"def",
"__execute_initial_load",
"(",
"self",
")",
":",
"if",
"self",
".",
"conf",
"[",
"'phases'",
"]",
"[",
"'panels'",
"]",
":",
"tasks_cls",
"=",
"[",
"TaskPanels",
",",
"TaskPanelsMenu",
"]",
"self",
".",
"execute_tasks",
"(",
"tasks_cls",
")",
"if",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | SirMordred.start | This method defines the workflow of SirMordred. So it calls to:
- initialize the databases
- execute the different phases for the first iteration
(collection, identities, enrichment)
- start the collection and enrichment in parallel by data source
- start also the Sorting Hat m... | sirmordred/sirmordred.py | def start(self):
"""
This method defines the workflow of SirMordred. So it calls to:
- initialize the databases
- execute the different phases for the first iteration
(collection, identities, enrichment)
- start the collection and enrichment in parallel by data source
... | def start(self):
"""
This method defines the workflow of SirMordred. So it calls to:
- initialize the databases
- execute the different phases for the first iteration
(collection, identities, enrichment)
- start the collection and enrichment in parallel by data source
... | [
"This",
"method",
"defines",
"the",
"workflow",
"of",
"SirMordred",
".",
"So",
"it",
"calls",
"to",
":",
"-",
"initialize",
"the",
"databases",
"-",
"execute",
"the",
"different",
"phases",
"for",
"the",
"first",
"iteration",
"(",
"collection",
"identities",
... | chaoss/grimoirelab-sirmordred | python | https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/sirmordred.py#L299-L395 | [
"def",
"start",
"(",
"self",
")",
":",
"# logger.debug(\"Starting SirMordred engine ...\")",
"logger",
".",
"info",
"(",
"\"\"",
")",
"logger",
".",
"info",
"(",
"\"----------------------------\"",
")",
"logger",
".",
"info",
"(",
"\"Starting SirMordred engine ...\"",
... | d6ac94d28d707fae23170064d078f1edf937d13e |
valid | Sultan.run | After building your commands, call `run()` to have your code executed. | src/sultan/api.py | def run(self, halt_on_nonzero=True, quiet=False, q=False, streaming=False):
"""
After building your commands, call `run()` to have your code executed.
"""
commands = str(self)
if not (quiet or q):
self._echo.cmd(commands)
env = self._context[0].get('env', {})... | def run(self, halt_on_nonzero=True, quiet=False, q=False, streaming=False):
"""
After building your commands, call `run()` to have your code executed.
"""
commands = str(self)
if not (quiet or q):
self._echo.cmd(commands)
env = self._context[0].get('env', {})... | [
"After",
"building",
"your",
"commands",
"call",
"run",
"()",
"to",
"have",
"your",
"code",
"executed",
"."
] | aeroxis/sultan | python | https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/api.py#L192-L223 | [
"def",
"run",
"(",
"self",
",",
"halt_on_nonzero",
"=",
"True",
",",
"quiet",
"=",
"False",
",",
"q",
"=",
"False",
",",
"streaming",
"=",
"False",
")",
":",
"commands",
"=",
"str",
"(",
"self",
")",
"if",
"not",
"(",
"quiet",
"or",
"q",
")",
":"... | 65b4271a161d6c19a9eb0170b5a95832a139ab7f |
valid | Config.validate_config | Validates the provided config to make sure all the required fields are
there. | src/sultan/api.py | def validate_config(self):
'''
Validates the provided config to make sure all the required fields are
there.
'''
# first ensure that all the required fields are there
for key, key_config in self.params_map.items():
if key_config['required']:
i... | def validate_config(self):
'''
Validates the provided config to make sure all the required fields are
there.
'''
# first ensure that all the required fields are there
for key, key_config in self.params_map.items():
if key_config['required']:
i... | [
"Validates",
"the",
"provided",
"config",
"to",
"make",
"sure",
"all",
"the",
"required",
"fields",
"are",
"there",
"."
] | aeroxis/sultan | python | https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/api.py#L505-L520 | [
"def",
"validate_config",
"(",
"self",
")",
":",
"# first ensure that all the required fields are there",
"for",
"key",
",",
"key_config",
"in",
"self",
".",
"params_map",
".",
"items",
"(",
")",
":",
"if",
"key_config",
"[",
"'required'",
"]",
":",
"if",
"key",... | 65b4271a161d6c19a9eb0170b5a95832a139ab7f |
valid | Result.stdout | Converts stdout string to a list. | src/sultan/result.py | def stdout(self):
"""
Converts stdout string to a list.
"""
if self._streaming:
stdout = []
while not self.__stdout.empty():
try:
line = self.__stdout.get_nowait()
stdout.append(line)
except:
... | def stdout(self):
"""
Converts stdout string to a list.
"""
if self._streaming:
stdout = []
while not self.__stdout.empty():
try:
line = self.__stdout.get_nowait()
stdout.append(line)
except:
... | [
"Converts",
"stdout",
"string",
"to",
"a",
"list",
"."
] | aeroxis/sultan | python | https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/result.py#L152-L166 | [
"def",
"stdout",
"(",
"self",
")",
":",
"if",
"self",
".",
"_streaming",
":",
"stdout",
"=",
"[",
"]",
"while",
"not",
"self",
".",
"__stdout",
".",
"empty",
"(",
")",
":",
"try",
":",
"line",
"=",
"self",
".",
"__stdout",
".",
"get_nowait",
"(",
... | 65b4271a161d6c19a9eb0170b5a95832a139ab7f |
valid | Result.stderr | Converts stderr string to a list. | src/sultan/result.py | def stderr(self):
"""
Converts stderr string to a list.
"""
if self._streaming:
stderr = []
while not self.__stderr.empty():
try:
line = self.__stderr.get_nowait()
stderr.append(line)
except:
... | def stderr(self):
"""
Converts stderr string to a list.
"""
if self._streaming:
stderr = []
while not self.__stderr.empty():
try:
line = self.__stderr.get_nowait()
stderr.append(line)
except:
... | [
"Converts",
"stderr",
"string",
"to",
"a",
"list",
"."
] | aeroxis/sultan | python | https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/result.py#L169-L183 | [
"def",
"stderr",
"(",
"self",
")",
":",
"if",
"self",
".",
"_streaming",
":",
"stderr",
"=",
"[",
"]",
"while",
"not",
"self",
".",
"__stderr",
".",
"empty",
"(",
")",
":",
"try",
":",
"line",
"=",
"self",
".",
"__stderr",
".",
"get_nowait",
"(",
... | 65b4271a161d6c19a9eb0170b5a95832a139ab7f |
valid | Result.print_stdout | Prints the stdout to console - if there is any stdout, otherwise does nothing.
:param always_print: print the stdout, even if there is nothing in the buffer (default: false) | src/sultan/result.py | def print_stdout(self, always_print=False):
"""
Prints the stdout to console - if there is any stdout, otherwise does nothing.
:param always_print: print the stdout, even if there is nothing in the buffer (default: false)
"""
if self.__stdout or always_print:
self._... | def print_stdout(self, always_print=False):
"""
Prints the stdout to console - if there is any stdout, otherwise does nothing.
:param always_print: print the stdout, even if there is nothing in the buffer (default: false)
"""
if self.__stdout or always_print:
self._... | [
"Prints",
"the",
"stdout",
"to",
"console",
"-",
"if",
"there",
"is",
"any",
"stdout",
"otherwise",
"does",
"nothing",
".",
":",
"param",
"always_print",
":",
"print",
"the",
"stdout",
"even",
"if",
"there",
"is",
"nothing",
"in",
"the",
"buffer",
"(",
"... | aeroxis/sultan | python | https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/result.py#L225-L233 | [
"def",
"print_stdout",
"(",
"self",
",",
"always_print",
"=",
"False",
")",
":",
"if",
"self",
".",
"__stdout",
"or",
"always_print",
":",
"self",
".",
"__echo",
".",
"info",
"(",
"\"--{ STDOUT }---\"",
"+",
"\"-\"",
"*",
"100",
")",
"self",
".",
"__form... | 65b4271a161d6c19a9eb0170b5a95832a139ab7f |
valid | Result.print_stderr | Prints the stderr to console - if there is any stdout, otherwise does nothing.
:param always_print: print the stderr, even if there is nothing in the buffer (default: false) | src/sultan/result.py | def print_stderr(self, always_print=False):
"""
Prints the stderr to console - if there is any stdout, otherwise does nothing.
:param always_print: print the stderr, even if there is nothing in the buffer (default: false)
"""
if self.__stderr or always_print:
self._... | def print_stderr(self, always_print=False):
"""
Prints the stderr to console - if there is any stdout, otherwise does nothing.
:param always_print: print the stderr, even if there is nothing in the buffer (default: false)
"""
if self.__stderr or always_print:
self._... | [
"Prints",
"the",
"stderr",
"to",
"console",
"-",
"if",
"there",
"is",
"any",
"stdout",
"otherwise",
"does",
"nothing",
".",
":",
"param",
"always_print",
":",
"print",
"the",
"stderr",
"even",
"if",
"there",
"is",
"nothing",
"in",
"the",
"buffer",
"(",
"... | aeroxis/sultan | python | https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/result.py#L235-L243 | [
"def",
"print_stderr",
"(",
"self",
",",
"always_print",
"=",
"False",
")",
":",
"if",
"self",
".",
"__stderr",
"or",
"always_print",
":",
"self",
".",
"__echo",
".",
"critical",
"(",
"\"--{ STDERR }---\"",
"+",
"\"-\"",
"*",
"100",
")",
"self",
".",
"__... | 65b4271a161d6c19a9eb0170b5a95832a139ab7f |
valid | Result.print_traceback | Prints the traceback to console - if there is any traceback, otherwise does nothing.
:param always_print: print the traceback, even if there is nothing in the buffer (default: false) | src/sultan/result.py | def print_traceback(self, always_print=False):
"""
Prints the traceback to console - if there is any traceback, otherwise does nothing.
:param always_print: print the traceback, even if there is nothing in the buffer (default: false)
"""
if self._exception or always_print:
... | def print_traceback(self, always_print=False):
"""
Prints the traceback to console - if there is any traceback, otherwise does nothing.
:param always_print: print the traceback, even if there is nothing in the buffer (default: false)
"""
if self._exception or always_print:
... | [
"Prints",
"the",
"traceback",
"to",
"console",
"-",
"if",
"there",
"is",
"any",
"traceback",
"otherwise",
"does",
"nothing",
".",
":",
"param",
"always_print",
":",
"print",
"the",
"traceback",
"even",
"if",
"there",
"is",
"nothing",
"in",
"the",
"buffer",
... | aeroxis/sultan | python | https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/result.py#L245-L253 | [
"def",
"print_traceback",
"(",
"self",
",",
"always_print",
"=",
"False",
")",
":",
"if",
"self",
".",
"_exception",
"or",
"always_print",
":",
"self",
".",
"__echo",
".",
"critical",
"(",
"\"--{ TRACEBACK }\"",
"+",
"\"-\"",
"*",
"100",
")",
"self",
".",
... | 65b4271a161d6c19a9eb0170b5a95832a139ab7f |
valid | LevelFormatter.format | Customize the message format based on the log level. | src/sultan/echo/colorlog/colorlog.py | def format(self, record):
"""Customize the message format based on the log level."""
if isinstance(self.fmt, dict):
self._fmt = self.fmt[record.levelname]
if sys.version_info > (3, 2):
# Update self._style because we've changed self._fmt
# (code ba... | def format(self, record):
"""Customize the message format based on the log level."""
if isinstance(self.fmt, dict):
self._fmt = self.fmt[record.levelname]
if sys.version_info > (3, 2):
# Update self._style because we've changed self._fmt
# (code ba... | [
"Customize",
"the",
"message",
"format",
"based",
"on",
"the",
"log",
"level",
"."
] | aeroxis/sultan | python | https://github.com/aeroxis/sultan/blob/65b4271a161d6c19a9eb0170b5a95832a139ab7f/src/sultan/echo/colorlog/colorlog.py#L182-L199 | [
"def",
"format",
"(",
"self",
",",
"record",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"fmt",
",",
"dict",
")",
":",
"self",
".",
"_fmt",
"=",
"self",
".",
"fmt",
"[",
"record",
".",
"levelname",
"]",
"if",
"sys",
".",
"version_info",
">",
... | 65b4271a161d6c19a9eb0170b5a95832a139ab7f |
valid | replace_print | Sys.out replacer, by default with stderr.
Use it like this:
with replace_print_with(fileobj):
print "hello" # writes to the file
print "done" # prints to stdout
Args:
fileobj: a file object to replace stdout.
Yields:
The printer. | dsub/lib/dsub_util.py | def replace_print(fileobj=sys.stderr):
"""Sys.out replacer, by default with stderr.
Use it like this:
with replace_print_with(fileobj):
print "hello" # writes to the file
print "done" # prints to stdout
Args:
fileobj: a file object to replace stdout.
Yields:
The printer.
"""
printer = _... | def replace_print(fileobj=sys.stderr):
"""Sys.out replacer, by default with stderr.
Use it like this:
with replace_print_with(fileobj):
print "hello" # writes to the file
print "done" # prints to stdout
Args:
fileobj: a file object to replace stdout.
Yields:
The printer.
"""
printer = _... | [
"Sys",
".",
"out",
"replacer",
"by",
"default",
"with",
"stderr",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L55-L76 | [
"def",
"replace_print",
"(",
"fileobj",
"=",
"sys",
".",
"stderr",
")",
":",
"printer",
"=",
"_Printer",
"(",
"fileobj",
")",
"previous_stdout",
"=",
"sys",
".",
"stdout",
"sys",
".",
"stdout",
"=",
"printer",
"try",
":",
"yield",
"printer",
"finally",
"... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | compact_interval_string | Compact a list of integers into a comma-separated string of intervals.
Args:
value_list: A list of sortable integers such as a list of numbers
Returns:
A compact string representation, such as "1-5,8,12-15" | dsub/lib/dsub_util.py | def compact_interval_string(value_list):
"""Compact a list of integers into a comma-separated string of intervals.
Args:
value_list: A list of sortable integers such as a list of numbers
Returns:
A compact string representation, such as "1-5,8,12-15"
"""
if not value_list:
return ''
value_li... | def compact_interval_string(value_list):
"""Compact a list of integers into a comma-separated string of intervals.
Args:
value_list: A list of sortable integers such as a list of numbers
Returns:
A compact string representation, such as "1-5,8,12-15"
"""
if not value_list:
return ''
value_li... | [
"Compact",
"a",
"list",
"of",
"integers",
"into",
"a",
"comma",
"-",
"separated",
"string",
"of",
"intervals",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L94-L127 | [
"def",
"compact_interval_string",
"(",
"value_list",
")",
":",
"if",
"not",
"value_list",
":",
"return",
"''",
"value_list",
".",
"sort",
"(",
")",
"# Start by simply building up a list of separate contiguous intervals",
"interval_list",
"=",
"[",
"]",
"curr",
"=",
"[... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _get_storage_service | Get a storage client using the provided credentials or defaults. | dsub/lib/dsub_util.py | def _get_storage_service(credentials):
"""Get a storage client using the provided credentials or defaults."""
if credentials is None:
credentials = oauth2client.client.GoogleCredentials.get_application_default(
)
return discovery.build('storage', 'v1', credentials=credentials) | def _get_storage_service(credentials):
"""Get a storage client using the provided credentials or defaults."""
if credentials is None:
credentials = oauth2client.client.GoogleCredentials.get_application_default(
)
return discovery.build('storage', 'v1', credentials=credentials) | [
"Get",
"a",
"storage",
"client",
"using",
"the",
"provided",
"credentials",
"or",
"defaults",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L130-L135 | [
"def",
"_get_storage_service",
"(",
"credentials",
")",
":",
"if",
"credentials",
"is",
"None",
":",
"credentials",
"=",
"oauth2client",
".",
"client",
".",
"GoogleCredentials",
".",
"get_application_default",
"(",
")",
"return",
"discovery",
".",
"build",
"(",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _retry_storage_check | Return True if we should retry, False otherwise. | dsub/lib/dsub_util.py | def _retry_storage_check(exception):
"""Return True if we should retry, False otherwise."""
now = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
print_error(
'%s: Exception %s: %s' % (now, type(exception).__name__, str(exception)))
return isinstance(exception, oauth2client.client.AccessTokenRefreshError) | def _retry_storage_check(exception):
"""Return True if we should retry, False otherwise."""
now = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
print_error(
'%s: Exception %s: %s' % (now, type(exception).__name__, str(exception)))
return isinstance(exception, oauth2client.client.AccessTokenRefreshError) | [
"Return",
"True",
"if",
"we",
"should",
"retry",
"False",
"otherwise",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L138-L143 | [
"def",
"_retry_storage_check",
"(",
"exception",
")",
":",
"now",
"=",
"datetime",
".",
"now",
"(",
")",
".",
"strftime",
"(",
"'%Y-%m-%d %H:%M:%S.%f'",
")",
"print_error",
"(",
"'%s: Exception %s: %s'",
"%",
"(",
"now",
",",
"type",
"(",
"exception",
")",
"... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _load_file_from_gcs | Load context from a text file in gcs.
Args:
gcs_file_path: The target file path; should have the 'gs://' prefix.
credentials: Optional credential to be used to load the file from gcs.
Returns:
The content of the text file as a string. | dsub/lib/dsub_util.py | def _load_file_from_gcs(gcs_file_path, credentials=None):
"""Load context from a text file in gcs.
Args:
gcs_file_path: The target file path; should have the 'gs://' prefix.
credentials: Optional credential to be used to load the file from gcs.
Returns:
The content of the text file as a string.
""... | def _load_file_from_gcs(gcs_file_path, credentials=None):
"""Load context from a text file in gcs.
Args:
gcs_file_path: The target file path; should have the 'gs://' prefix.
credentials: Optional credential to be used to load the file from gcs.
Returns:
The content of the text file as a string.
""... | [
"Load",
"context",
"from",
"a",
"text",
"file",
"in",
"gcs",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L158-L182 | [
"def",
"_load_file_from_gcs",
"(",
"gcs_file_path",
",",
"credentials",
"=",
"None",
")",
":",
"gcs_service",
"=",
"_get_storage_service",
"(",
"credentials",
")",
"bucket_name",
",",
"object_name",
"=",
"gcs_file_path",
"[",
"len",
"(",
"'gs://'",
")",
":",
"]"... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | load_file | Load a file from either local or gcs.
Args:
file_path: The target file path, which should have the prefix 'gs://' if
to be loaded from gcs.
credentials: Optional credential to be used to load the file from gcs.
Returns:
A python File object if loading file from local or a StringIO objec... | dsub/lib/dsub_util.py | def load_file(file_path, credentials=None):
"""Load a file from either local or gcs.
Args:
file_path: The target file path, which should have the prefix 'gs://' if
to be loaded from gcs.
credentials: Optional credential to be used to load the file from gcs.
Returns:
A python File obje... | def load_file(file_path, credentials=None):
"""Load a file from either local or gcs.
Args:
file_path: The target file path, which should have the prefix 'gs://' if
to be loaded from gcs.
credentials: Optional credential to be used to load the file from gcs.
Returns:
A python File obje... | [
"Load",
"a",
"file",
"from",
"either",
"local",
"or",
"gcs",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L185-L200 | [
"def",
"load_file",
"(",
"file_path",
",",
"credentials",
"=",
"None",
")",
":",
"if",
"file_path",
".",
"startswith",
"(",
"'gs://'",
")",
":",
"return",
"_load_file_from_gcs",
"(",
"file_path",
",",
"credentials",
")",
"else",
":",
"return",
"open",
"(",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _file_exists_in_gcs | Check whether the file exists, in GCS.
Args:
gcs_file_path: The target file path; should have the 'gs://' prefix.
credentials: Optional credential to be used to load the file from gcs.
Returns:
True if the file's there. | dsub/lib/dsub_util.py | def _file_exists_in_gcs(gcs_file_path, credentials=None):
"""Check whether the file exists, in GCS.
Args:
gcs_file_path: The target file path; should have the 'gs://' prefix.
credentials: Optional credential to be used to load the file from gcs.
Returns:
True if the file's there.
"""
gcs_service... | def _file_exists_in_gcs(gcs_file_path, credentials=None):
"""Check whether the file exists, in GCS.
Args:
gcs_file_path: The target file path; should have the 'gs://' prefix.
credentials: Optional credential to be used to load the file from gcs.
Returns:
True if the file's there.
"""
gcs_service... | [
"Check",
"whether",
"the",
"file",
"exists",
"in",
"GCS",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L211-L230 | [
"def",
"_file_exists_in_gcs",
"(",
"gcs_file_path",
",",
"credentials",
"=",
"None",
")",
":",
"gcs_service",
"=",
"_get_storage_service",
"(",
"credentials",
")",
"bucket_name",
",",
"object_name",
"=",
"gcs_file_path",
"[",
"len",
"(",
"'gs://'",
")",
":",
"]"... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | file_exists | Check whether the file exists, on local disk or GCS.
Args:
file_path: The target file path; should have the 'gs://' prefix if in gcs.
credentials: Optional credential to be used to load the file from gcs.
Returns:
True if the file's there. | dsub/lib/dsub_util.py | def file_exists(file_path, credentials=None):
"""Check whether the file exists, on local disk or GCS.
Args:
file_path: The target file path; should have the 'gs://' prefix if in gcs.
credentials: Optional credential to be used to load the file from gcs.
Returns:
True if the file's there.
"""
if ... | def file_exists(file_path, credentials=None):
"""Check whether the file exists, on local disk or GCS.
Args:
file_path: The target file path; should have the 'gs://' prefix if in gcs.
credentials: Optional credential to be used to load the file from gcs.
Returns:
True if the file's there.
"""
if ... | [
"Check",
"whether",
"the",
"file",
"exists",
"on",
"local",
"disk",
"or",
"GCS",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L233-L246 | [
"def",
"file_exists",
"(",
"file_path",
",",
"credentials",
"=",
"None",
")",
":",
"if",
"file_path",
".",
"startswith",
"(",
"'gs://'",
")",
":",
"return",
"_file_exists_in_gcs",
"(",
"file_path",
",",
"credentials",
")",
"else",
":",
"return",
"os",
".",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _prefix_exists_in_gcs | Check whether there is a GCS object whose name starts with the prefix.
Since GCS doesn't actually have folders, this is how we check instead.
Args:
gcs_prefix: The path; should start with 'gs://'.
credentials: Optional credential to be used to load the file from gcs.
Returns:
True if the prefix mat... | dsub/lib/dsub_util.py | def _prefix_exists_in_gcs(gcs_prefix, credentials=None):
"""Check whether there is a GCS object whose name starts with the prefix.
Since GCS doesn't actually have folders, this is how we check instead.
Args:
gcs_prefix: The path; should start with 'gs://'.
credentials: Optional credential to be used to ... | def _prefix_exists_in_gcs(gcs_prefix, credentials=None):
"""Check whether there is a GCS object whose name starts with the prefix.
Since GCS doesn't actually have folders, this is how we check instead.
Args:
gcs_prefix: The path; should start with 'gs://'.
credentials: Optional credential to be used to ... | [
"Check",
"whether",
"there",
"is",
"a",
"GCS",
"object",
"whose",
"name",
"starts",
"with",
"the",
"prefix",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L257-L280 | [
"def",
"_prefix_exists_in_gcs",
"(",
"gcs_prefix",
",",
"credentials",
"=",
"None",
")",
":",
"gcs_service",
"=",
"_get_storage_service",
"(",
"credentials",
")",
"bucket_name",
",",
"prefix",
"=",
"gcs_prefix",
"[",
"len",
"(",
"'gs://'",
")",
":",
"]",
".",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | simple_pattern_exists_in_gcs | True iff an object exists matching the input GCS pattern.
The GCS pattern must be a full object reference or a "simple pattern" that
conforms to the dsub input and output parameter restrictions:
* No support for **, ? wildcards or [] character ranges
* Wildcards may only appear in the file name
Args:
... | dsub/lib/dsub_util.py | def simple_pattern_exists_in_gcs(file_pattern, credentials=None):
"""True iff an object exists matching the input GCS pattern.
The GCS pattern must be a full object reference or a "simple pattern" that
conforms to the dsub input and output parameter restrictions:
* No support for **, ? wildcards or [] chara... | def simple_pattern_exists_in_gcs(file_pattern, credentials=None):
"""True iff an object exists matching the input GCS pattern.
The GCS pattern must be a full object reference or a "simple pattern" that
conforms to the dsub input and output parameter restrictions:
* No support for **, ? wildcards or [] chara... | [
"True",
"iff",
"an",
"object",
"exists",
"matching",
"the",
"input",
"GCS",
"pattern",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L298-L335 | [
"def",
"simple_pattern_exists_in_gcs",
"(",
"file_pattern",
",",
"credentials",
"=",
"None",
")",
":",
"if",
"'*'",
"not",
"in",
"file_pattern",
":",
"return",
"_file_exists_in_gcs",
"(",
"file_pattern",
",",
"credentials",
")",
"if",
"not",
"file_pattern",
".",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | outputs_are_present | True if each output contains at least one file or no output specified. | dsub/lib/dsub_util.py | def outputs_are_present(outputs):
"""True if each output contains at least one file or no output specified."""
# outputs are OutputFileParam (see param_util.py)
# If outputs contain a pattern, then there is no way for `dsub` to verify
# that *all* output is present. The best that `dsub` can do is to verify
#... | def outputs_are_present(outputs):
"""True if each output contains at least one file or no output specified."""
# outputs are OutputFileParam (see param_util.py)
# If outputs contain a pattern, then there is no way for `dsub` to verify
# that *all* output is present. The best that `dsub` can do is to verify
#... | [
"True",
"if",
"each",
"output",
"contains",
"at",
"least",
"one",
"file",
"or",
"no",
"output",
"specified",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/lib/dsub_util.py#L338-L354 | [
"def",
"outputs_are_present",
"(",
"outputs",
")",
":",
"# outputs are OutputFileParam (see param_util.py)",
"# If outputs contain a pattern, then there is no way for `dsub` to verify",
"# that *all* output is present. The best that `dsub` can do is to verify",
"# that *some* output was created fo... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _Pipelines._build_pipeline_input_file_param | Return a dict object representing a pipeline input argument. | dsub/providers/google.py | def _build_pipeline_input_file_param(cls, var_name, docker_path):
"""Return a dict object representing a pipeline input argument."""
# If the filename contains a wildcard, then the target Docker path must
# be a directory in order to ensure consistency whether the source pattern
# contains 1 or multipl... | def _build_pipeline_input_file_param(cls, var_name, docker_path):
"""Return a dict object representing a pipeline input argument."""
# If the filename contains a wildcard, then the target Docker path must
# be a directory in order to ensure consistency whether the source pattern
# contains 1 or multipl... | [
"Return",
"a",
"dict",
"object",
"representing",
"a",
"pipeline",
"input",
"argument",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L132-L147 | [
"def",
"_build_pipeline_input_file_param",
"(",
"cls",
",",
"var_name",
",",
"docker_path",
")",
":",
"# If the filename contains a wildcard, then the target Docker path must",
"# be a directory in order to ensure consistency whether the source pattern",
"# contains 1 or multiple files.",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _Pipelines._build_pipeline_docker_command | Return a multi-line string of the full pipeline docker command. | dsub/providers/google.py | def _build_pipeline_docker_command(cls, script_name, inputs, outputs, envs):
"""Return a multi-line string of the full pipeline docker command."""
# We upload the user script as an environment argument
# and write it to SCRIPT_DIR (preserving its local file name).
#
# The docker_command:
# * wr... | def _build_pipeline_docker_command(cls, script_name, inputs, outputs, envs):
"""Return a multi-line string of the full pipeline docker command."""
# We upload the user script as an environment argument
# and write it to SCRIPT_DIR (preserving its local file name).
#
# The docker_command:
# * wr... | [
"Return",
"a",
"multi",
"-",
"line",
"string",
"of",
"the",
"full",
"pipeline",
"docker",
"command",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L161-L245 | [
"def",
"_build_pipeline_docker_command",
"(",
"cls",
",",
"script_name",
",",
"inputs",
",",
"outputs",
",",
"envs",
")",
":",
"# We upload the user script as an environment argument",
"# and write it to SCRIPT_DIR (preserving its local file name).",
"#",
"# The docker_command:",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _Pipelines.build_pipeline | Builds a pipeline configuration for execution.
Args:
project: string name of project.
zones: list of zone names for jobs to be run at.
min_cores: int number of CPU cores required per job.
min_ram: int GB of RAM required per job.
disk_size: int GB of disk to attach under /mnt/data.
... | dsub/providers/google.py | def build_pipeline(cls, project, zones, min_cores, min_ram, disk_size,
boot_disk_size, preemptible, accelerator_type,
accelerator_count, image, script_name, envs, inputs,
outputs, pipeline_name):
"""Builds a pipeline configuration for execution.
Ar... | def build_pipeline(cls, project, zones, min_cores, min_ram, disk_size,
boot_disk_size, preemptible, accelerator_type,
accelerator_count, image, script_name, envs, inputs,
outputs, pipeline_name):
"""Builds a pipeline configuration for execution.
Ar... | [
"Builds",
"a",
"pipeline",
"configuration",
"for",
"execution",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L248-L367 | [
"def",
"build_pipeline",
"(",
"cls",
",",
"project",
",",
"zones",
",",
"min_cores",
",",
"min_ram",
",",
"disk_size",
",",
"boot_disk_size",
",",
"preemptible",
",",
"accelerator_type",
",",
"accelerator_count",
",",
"image",
",",
"script_name",
",",
"envs",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _Pipelines.build_pipeline_args | Builds pipeline args for execution.
Args:
project: string name of project.
script: Body of the script to execute.
job_params: dictionary of values for labels, envs, inputs, and outputs
for this job.
task_params: dictionary of values for labels, envs, inputs, and outputs
... | dsub/providers/google.py | def build_pipeline_args(cls, project, script, job_params, task_params,
reserved_labels, preemptible, logging_uri, scopes,
keep_alive):
"""Builds pipeline args for execution.
Args:
project: string name of project.
script: Body of the script to exec... | def build_pipeline_args(cls, project, script, job_params, task_params,
reserved_labels, preemptible, logging_uri, scopes,
keep_alive):
"""Builds pipeline args for execution.
Args:
project: string name of project.
script: Body of the script to exec... | [
"Builds",
"pipeline",
"args",
"for",
"execution",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L371-L455 | [
"def",
"build_pipeline_args",
"(",
"cls",
",",
"project",
",",
"script",
",",
"job_params",
",",
"task_params",
",",
"reserved_labels",
",",
"preemptible",
",",
"logging_uri",
",",
"scopes",
",",
"keep_alive",
")",
":",
"# For the Pipelines API, envs and file inputs a... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _Operations._datetime_to_utc_int | Convert the integer UTC time value into a local datetime. | dsub/providers/google.py | def _datetime_to_utc_int(date):
"""Convert the integer UTC time value into a local datetime."""
if date is None:
return None
# Convert localized datetime to a UTC integer
epoch = dsub_util.replace_timezone(datetime.utcfromtimestamp(0), pytz.utc)
return (date - epoch).total_seconds() | def _datetime_to_utc_int(date):
"""Convert the integer UTC time value into a local datetime."""
if date is None:
return None
# Convert localized datetime to a UTC integer
epoch = dsub_util.replace_timezone(datetime.utcfromtimestamp(0), pytz.utc)
return (date - epoch).total_seconds() | [
"Convert",
"the",
"integer",
"UTC",
"time",
"value",
"into",
"a",
"local",
"datetime",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L466-L473 | [
"def",
"_datetime_to_utc_int",
"(",
"date",
")",
":",
"if",
"date",
"is",
"None",
":",
"return",
"None",
"# Convert localized datetime to a UTC integer",
"epoch",
"=",
"dsub_util",
".",
"replace_timezone",
"(",
"datetime",
".",
"utcfromtimestamp",
"(",
"0",
")",
"... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _Operations.get_filter | Return a filter string for operations.list(). | dsub/providers/google.py | def get_filter(project,
status=None,
user_id=None,
job_id=None,
job_name=None,
labels=None,
task_id=None,
task_attempt=None,
create_time_min=None,
create_time_max=None... | def get_filter(project,
status=None,
user_id=None,
job_id=None,
job_name=None,
labels=None,
task_id=None,
task_attempt=None,
create_time_min=None,
create_time_max=None... | [
"Return",
"a",
"filter",
"string",
"for",
"operations",
".",
"list",
"()",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L476-L517 | [
"def",
"get_filter",
"(",
"project",
",",
"status",
"=",
"None",
",",
"user_id",
"=",
"None",
",",
"job_id",
"=",
"None",
",",
"job_name",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"task_id",
"=",
"None",
",",
"task_attempt",
"=",
"None",
",",
"c... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _Operations.is_dsub_operation | Determine if a pipelines operation is a dsub request.
We don't have a rigorous way to identify an operation as being submitted
by dsub. Our best option is to check for certain fields that have always
been part of dsub operations.
- labels: job-id, job-name, and user-id have always existed
- envs: ... | dsub/providers/google.py | def is_dsub_operation(cls, op):
"""Determine if a pipelines operation is a dsub request.
We don't have a rigorous way to identify an operation as being submitted
by dsub. Our best option is to check for certain fields that have always
been part of dsub operations.
- labels: job-id, job-name, and u... | def is_dsub_operation(cls, op):
"""Determine if a pipelines operation is a dsub request.
We don't have a rigorous way to identify an operation as being submitted
by dsub. Our best option is to check for certain fields that have always
been part of dsub operations.
- labels: job-id, job-name, and u... | [
"Determine",
"if",
"a",
"pipelines",
"operation",
"is",
"a",
"dsub",
"request",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L544-L568 | [
"def",
"is_dsub_operation",
"(",
"cls",
",",
"op",
")",
":",
"if",
"not",
"cls",
".",
"is_pipelines_operation",
"(",
"op",
")",
":",
"return",
"False",
"for",
"name",
"in",
"[",
"'job-id'",
",",
"'job-name'",
",",
"'user-id'",
"]",
":",
"if",
"not",
"c... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _Operations.list | Gets the list of operations for the specified filter.
Args:
service: Google Genomics API service object
ops_filter: string filter of operations to return
page_size: the number of operations to requested on each list operation to
the pipelines API (if 0 or None, the API default is used)
... | dsub/providers/google.py | def list(cls, service, ops_filter, page_size=0):
"""Gets the list of operations for the specified filter.
Args:
service: Google Genomics API service object
ops_filter: string filter of operations to return
page_size: the number of operations to requested on each list operation to
the ... | def list(cls, service, ops_filter, page_size=0):
"""Gets the list of operations for the specified filter.
Args:
service: Google Genomics API service object
ops_filter: string filter of operations to return
page_size: the number of operations to requested on each list operation to
the ... | [
"Gets",
"the",
"list",
"of",
"operations",
"for",
"the",
"specified",
"filter",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L571-L607 | [
"def",
"list",
"(",
"cls",
",",
"service",
",",
"ops_filter",
",",
"page_size",
"=",
"0",
")",
":",
"page_token",
"=",
"None",
"more_operations",
"=",
"True",
"documented_default_page_size",
"=",
"256",
"documented_max_page_size",
"=",
"2048",
"if",
"not",
"pa... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleJobProvider.prepare_job_metadata | Returns a dictionary of metadata fields for the job. | dsub/providers/google.py | def prepare_job_metadata(self, script, job_name, user_id, create_time):
"""Returns a dictionary of metadata fields for the job."""
return google_base.prepare_job_metadata(script, job_name, user_id,
create_time) | def prepare_job_metadata(self, script, job_name, user_id, create_time):
"""Returns a dictionary of metadata fields for the job."""
return google_base.prepare_job_metadata(script, job_name, user_id,
create_time) | [
"Returns",
"a",
"dictionary",
"of",
"metadata",
"fields",
"for",
"the",
"job",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L638-L641 | [
"def",
"prepare_job_metadata",
"(",
"self",
",",
"script",
",",
"job_name",
",",
"user_id",
",",
"create_time",
")",
":",
"return",
"google_base",
".",
"prepare_job_metadata",
"(",
"script",
",",
"job_name",
",",
"user_id",
",",
"create_time",
")"
] | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleJobProvider._build_pipeline_request | Returns a Pipeline objects for the job. | dsub/providers/google.py | def _build_pipeline_request(self, task_view):
"""Returns a Pipeline objects for the job."""
job_metadata = task_view.job_metadata
job_params = task_view.job_params
job_resources = task_view.job_resources
task_metadata = task_view.task_descriptors[0].task_metadata
task_params = task_view.task_des... | def _build_pipeline_request(self, task_view):
"""Returns a Pipeline objects for the job."""
job_metadata = task_view.job_metadata
job_params = task_view.job_params
job_resources = task_view.job_resources
task_metadata = task_view.task_descriptors[0].task_metadata
task_params = task_view.task_des... | [
"Returns",
"a",
"Pipeline",
"objects",
"for",
"the",
"job",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L643-L686 | [
"def",
"_build_pipeline_request",
"(",
"self",
",",
"task_view",
")",
":",
"job_metadata",
"=",
"task_view",
".",
"job_metadata",
"job_params",
"=",
"task_view",
".",
"job_params",
"job_resources",
"=",
"task_view",
".",
"job_resources",
"task_metadata",
"=",
"task_... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleJobProvider.lookup_job_tasks | Yields operations based on the input criteria.
If any of the filters are empty or {'*'}, then no filtering is performed on
that field. Filtering by both a job id list and job name list is
unsupported.
Args:
statuses: {'*'}, or a list of job status strings to return. Valid
status strings ... | dsub/providers/google.py | def lookup_job_tasks(self,
statuses,
user_ids=None,
job_ids=None,
job_names=None,
task_ids=None,
task_attempts=None,
labels=None,
create... | def lookup_job_tasks(self,
statuses,
user_ids=None,
job_ids=None,
job_names=None,
task_ids=None,
task_attempts=None,
labels=None,
create... | [
"Yields",
"operations",
"based",
"on",
"the",
"input",
"criteria",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L754-L859 | [
"def",
"lookup_job_tasks",
"(",
"self",
",",
"statuses",
",",
"user_ids",
"=",
"None",
",",
"job_ids",
"=",
"None",
",",
"job_names",
"=",
"None",
",",
"task_ids",
"=",
"None",
",",
"task_attempts",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"create_t... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleJobProvider.delete_jobs | Kills the operations associated with the specified job or job.task.
Args:
user_ids: List of user ids who "own" the job(s) to cancel.
job_ids: List of job_ids to cancel.
task_ids: List of task-ids to cancel.
labels: List of LabelParam, each must match the job(s) to be canceled.
create_... | dsub/providers/google.py | def delete_jobs(self,
user_ids,
job_ids,
task_ids,
labels,
create_time_min=None,
create_time_max=None):
"""Kills the operations associated with the specified job or job.task.
Args:
user_ids: List o... | def delete_jobs(self,
user_ids,
job_ids,
task_ids,
labels,
create_time_min=None,
create_time_max=None):
"""Kills the operations associated with the specified job or job.task.
Args:
user_ids: List o... | [
"Kills",
"the",
"operations",
"associated",
"with",
"the",
"specified",
"job",
"or",
"job",
".",
"task",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L861-L897 | [
"def",
"delete_jobs",
"(",
"self",
",",
"user_ids",
",",
"job_ids",
",",
"task_ids",
",",
"labels",
",",
"create_time_min",
"=",
"None",
",",
"create_time_max",
"=",
"None",
")",
":",
"# Look up the job(s)",
"tasks",
"=",
"list",
"(",
"self",
".",
"lookup_jo... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleOperation.get_field | Returns a value from the operation for a specific set of field names.
Args:
field: a dsub-specific job metadata key
default: default value to return if field does not exist or is empty.
Returns:
A text string for the field or a list for 'inputs'.
Raises:
ValueError: if the field l... | dsub/providers/google.py | def get_field(self, field, default=None):
"""Returns a value from the operation for a specific set of field names.
Args:
field: a dsub-specific job metadata key
default: default value to return if field does not exist or is empty.
Returns:
A text string for the field or a list for 'input... | def get_field(self, field, default=None):
"""Returns a value from the operation for a specific set of field names.
Args:
field: a dsub-specific job metadata key
default: default value to return if field does not exist or is empty.
Returns:
A text string for the field or a list for 'input... | [
"Returns",
"a",
"value",
"from",
"the",
"operation",
"for",
"a",
"specific",
"set",
"of",
"field",
"names",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L918-L1032 | [
"def",
"get_field",
"(",
"self",
",",
"field",
",",
"default",
"=",
"None",
")",
":",
"metadata",
"=",
"self",
".",
"_op",
".",
"get",
"(",
"'metadata'",
")",
"value",
"=",
"None",
"if",
"field",
"==",
"'internal-id'",
":",
"value",
"=",
"self",
".",... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleOperation._operation_status_message | Returns the most relevant status string and last updated date string.
This string is meant for display only.
Returns:
A printable status string and date string. | dsub/providers/google.py | def _operation_status_message(self):
"""Returns the most relevant status string and last updated date string.
This string is meant for display only.
Returns:
A printable status string and date string.
"""
metadata = self._op['metadata']
if not self._op['done']:
if 'events' in metad... | def _operation_status_message(self):
"""Returns the most relevant status string and last updated date string.
This string is meant for display only.
Returns:
A printable status string and date string.
"""
metadata = self._op['metadata']
if not self._op['done']:
if 'events' in metad... | [
"Returns",
"the",
"most",
"relevant",
"status",
"string",
"and",
"last",
"updated",
"date",
"string",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L1050-L1077 | [
"def",
"_operation_status_message",
"(",
"self",
")",
":",
"metadata",
"=",
"self",
".",
"_op",
"[",
"'metadata'",
"]",
"if",
"not",
"self",
".",
"_op",
"[",
"'done'",
"]",
":",
"if",
"'events'",
"in",
"metadata",
"and",
"metadata",
"[",
"'events'",
"]",... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleOperation._get_operation_input_field_values | Returns a dictionary of envs or file inputs for an operation.
Args:
metadata: operation metadata field
file_input: True to return a dict of file inputs, False to return envs.
Returns:
A dictionary of input field name value pairs | dsub/providers/google.py | def _get_operation_input_field_values(self, metadata, file_input):
"""Returns a dictionary of envs or file inputs for an operation.
Args:
metadata: operation metadata field
file_input: True to return a dict of file inputs, False to return envs.
Returns:
A dictionary of input field name v... | def _get_operation_input_field_values(self, metadata, file_input):
"""Returns a dictionary of envs or file inputs for an operation.
Args:
metadata: operation metadata field
file_input: True to return a dict of file inputs, False to return envs.
Returns:
A dictionary of input field name v... | [
"Returns",
"a",
"dictionary",
"of",
"envs",
"or",
"file",
"inputs",
"for",
"an",
"operation",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L1079-L1102 | [
"def",
"_get_operation_input_field_values",
"(",
"self",
",",
"metadata",
",",
"file_input",
")",
":",
"# To determine input parameter type, we iterate through the",
"# pipeline inputParameters.",
"# The values come from the pipelineArgs inputs.",
"input_args",
"=",
"metadata",
"[",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleOperation.error_message | Returns an error message if the operation failed for any reason.
Failure as defined here means; ended for any reason other than 'success'.
This means that a successful cancelation will also create an error message
here.
Returns:
string, string will be empty if job did not error. | dsub/providers/google.py | def error_message(self):
"""Returns an error message if the operation failed for any reason.
Failure as defined here means; ended for any reason other than 'success'.
This means that a successful cancelation will also create an error message
here.
Returns:
string, string will be empty if job... | def error_message(self):
"""Returns an error message if the operation failed for any reason.
Failure as defined here means; ended for any reason other than 'success'.
This means that a successful cancelation will also create an error message
here.
Returns:
string, string will be empty if job... | [
"Returns",
"an",
"error",
"message",
"if",
"the",
"operation",
"failed",
"for",
"any",
"reason",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google.py#L1121-L1140 | [
"def",
"error_message",
"(",
"self",
")",
":",
"if",
"'error'",
"in",
"self",
".",
"_op",
":",
"if",
"'task-id'",
"in",
"self",
".",
"_op",
"[",
"'metadata'",
"]",
"[",
"'labels'",
"]",
":",
"job_id",
"=",
"self",
".",
"_op",
"[",
"'metadata'",
"]",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _format_task_name | Create a task name from a job-id, task-id, and task-attempt.
Task names are used internally by dsub as well as by the docker task runner.
The name is formatted as "<job-id>.<task-id>[.task-attempt]". Task names
follow formatting conventions allowing them to be safely used as a docker
name.
Args:
job_id:... | dsub/providers/local.py | def _format_task_name(job_id, task_id, task_attempt):
"""Create a task name from a job-id, task-id, and task-attempt.
Task names are used internally by dsub as well as by the docker task runner.
The name is formatted as "<job-id>.<task-id>[.task-attempt]". Task names
follow formatting conventions allowing them... | def _format_task_name(job_id, task_id, task_attempt):
"""Create a task name from a job-id, task-id, and task-attempt.
Task names are used internally by dsub as well as by the docker task runner.
The name is formatted as "<job-id>.<task-id>[.task-attempt]". Task names
follow formatting conventions allowing them... | [
"Create",
"a",
"task",
"name",
"from",
"a",
"job",
"-",
"id",
"task",
"-",
"id",
"and",
"task",
"-",
"attempt",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L119-L142 | [
"def",
"_format_task_name",
"(",
"job_id",
",",
"task_id",
",",
"task_attempt",
")",
":",
"docker_name",
"=",
"'%s.%s'",
"%",
"(",
"job_id",
",",
"'task'",
"if",
"task_id",
"is",
"None",
"else",
"task_id",
")",
"if",
"task_attempt",
"is",
"not",
"None",
":... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _convert_suffix_to_docker_chars | Rewrite string so that all characters are valid in a docker name suffix. | dsub/providers/local.py | def _convert_suffix_to_docker_chars(suffix):
"""Rewrite string so that all characters are valid in a docker name suffix."""
# Docker container names must match: [a-zA-Z0-9][a-zA-Z0-9_.-]
accepted_characters = string.ascii_letters + string.digits + '_.-'
def label_char_transform(char):
if char in accepted_c... | def _convert_suffix_to_docker_chars(suffix):
"""Rewrite string so that all characters are valid in a docker name suffix."""
# Docker container names must match: [a-zA-Z0-9][a-zA-Z0-9_.-]
accepted_characters = string.ascii_letters + string.digits + '_.-'
def label_char_transform(char):
if char in accepted_c... | [
"Rewrite",
"string",
"so",
"that",
"all",
"characters",
"are",
"valid",
"in",
"a",
"docker",
"name",
"suffix",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L145-L155 | [
"def",
"_convert_suffix_to_docker_chars",
"(",
"suffix",
")",
":",
"# Docker container names must match: [a-zA-Z0-9][a-zA-Z0-9_.-]",
"accepted_characters",
"=",
"string",
".",
"ascii_letters",
"+",
"string",
".",
"digits",
"+",
"'_.-'",
"def",
"label_char_transform",
"(",
"... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | _task_sort_function | Return a tuple for sorting 'most recent first'. | dsub/providers/local.py | def _task_sort_function(task):
"""Return a tuple for sorting 'most recent first'."""
return (task.get_field('create-time'), int(task.get_field('task-id', 0)),
int(task.get_field('task-attempt', 0))) | def _task_sort_function(task):
"""Return a tuple for sorting 'most recent first'."""
return (task.get_field('create-time'), int(task.get_field('task-id', 0)),
int(task.get_field('task-attempt', 0))) | [
"Return",
"a",
"tuple",
"for",
"sorting",
"most",
"recent",
"first",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L158-L161 | [
"def",
"_task_sort_function",
"(",
"task",
")",
":",
"return",
"(",
"task",
".",
"get_field",
"(",
"'create-time'",
")",
",",
"int",
"(",
"task",
".",
"get_field",
"(",
"'task-id'",
",",
"0",
")",
")",
",",
"int",
"(",
"task",
".",
"get_field",
"(",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | LocalJobProvider._datetime_in_range | Determine if the provided time is within the range, inclusive. | dsub/providers/local.py | def _datetime_in_range(self, dt, dt_min=None, dt_max=None):
"""Determine if the provided time is within the range, inclusive."""
# The pipelines API stores operation create-time with second granularity.
# We mimic this behavior in the local provider by truncating to seconds.
dt = dt.replace(microsecond=... | def _datetime_in_range(self, dt, dt_min=None, dt_max=None):
"""Determine if the provided time is within the range, inclusive."""
# The pipelines API stores operation create-time with second granularity.
# We mimic this behavior in the local provider by truncating to seconds.
dt = dt.replace(microsecond=... | [
"Determine",
"if",
"the",
"provided",
"time",
"is",
"within",
"the",
"range",
"inclusive",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L566-L580 | [
"def",
"_datetime_in_range",
"(",
"self",
",",
"dt",
",",
"dt_min",
"=",
"None",
",",
"dt_max",
"=",
"None",
")",
":",
"# The pipelines API stores operation create-time with second granularity.",
"# We mimic this behavior in the local provider by truncating to seconds.",
"dt",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | LocalJobProvider._get_task_from_task_dir | Return a Task object with this task's info. | dsub/providers/local.py | def _get_task_from_task_dir(self, job_id, user_id, task_id, task_attempt):
"""Return a Task object with this task's info."""
# We need to be very careful about how we read and interpret the contents
# of the task directory. The directory could be changing because a new
# task is being created. The dire... | def _get_task_from_task_dir(self, job_id, user_id, task_id, task_attempt):
"""Return a Task object with this task's info."""
# We need to be very careful about how we read and interpret the contents
# of the task directory. The directory could be changing because a new
# task is being created. The dire... | [
"Return",
"a",
"Task",
"object",
"with",
"this",
"task",
"s",
"info",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L641-L699 | [
"def",
"_get_task_from_task_dir",
"(",
"self",
",",
"job_id",
",",
"user_id",
",",
"task_id",
",",
"task_attempt",
")",
":",
"# We need to be very careful about how we read and interpret the contents",
"# of the task directory. The directory could be changing because a new",
"# task ... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | LocalJobProvider._delocalize_logging_command | Returns a command to delocalize logs.
Args:
logging_path: location of log files.
user_project: name of the project to be billed for the request.
Returns:
eg. 'gs://bucket/path/myfile' or 'gs://bucket/script-foobar-12' | dsub/providers/local.py | def _delocalize_logging_command(self, logging_path, user_project):
"""Returns a command to delocalize logs.
Args:
logging_path: location of log files.
user_project: name of the project to be billed for the request.
Returns:
eg. 'gs://bucket/path/myfile' or 'gs://bucket/script-foobar-12'
... | def _delocalize_logging_command(self, logging_path, user_project):
"""Returns a command to delocalize logs.
Args:
logging_path: location of log files.
user_project: name of the project to be billed for the request.
Returns:
eg. 'gs://bucket/path/myfile' or 'gs://bucket/script-foobar-12'
... | [
"Returns",
"a",
"command",
"to",
"delocalize",
"logs",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L704-L745 | [
"def",
"_delocalize_logging_command",
"(",
"self",
",",
"logging_path",
",",
"user_project",
")",
":",
"# Get the logging prefix (everything up to \".log\")",
"logging_prefix",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"logging_path",
".",
"uri",
")",
"[",
"0",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | LocalJobProvider._task_directory | The local dir for staging files for that particular task. | dsub/providers/local.py | def _task_directory(self, job_id, task_id, task_attempt):
"""The local dir for staging files for that particular task."""
dir_name = 'task' if task_id is None else str(task_id)
if task_attempt:
dir_name = '%s.%s' % (dir_name, task_attempt)
return self._provider_root() + '/' + job_id + '/' + dir_na... | def _task_directory(self, job_id, task_id, task_attempt):
"""The local dir for staging files for that particular task."""
dir_name = 'task' if task_id is None else str(task_id)
if task_attempt:
dir_name = '%s.%s' % (dir_name, task_attempt)
return self._provider_root() + '/' + job_id + '/' + dir_na... | [
"The",
"local",
"dir",
"for",
"staging",
"files",
"for",
"that",
"particular",
"task",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L765-L770 | [
"def",
"_task_directory",
"(",
"self",
",",
"job_id",
",",
"task_id",
",",
"task_attempt",
")",
":",
"dir_name",
"=",
"'task'",
"if",
"task_id",
"is",
"None",
"else",
"str",
"(",
"task_id",
")",
"if",
"task_attempt",
":",
"dir_name",
"=",
"'%s.%s'",
"%",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | LocalJobProvider._make_environment | Return a dictionary of environment variables for the container. | dsub/providers/local.py | def _make_environment(self, inputs, outputs, mounts):
"""Return a dictionary of environment variables for the container."""
env = {}
env.update(providers_util.get_file_environment_variables(inputs))
env.update(providers_util.get_file_environment_variables(outputs))
env.update(providers_util.get_file... | def _make_environment(self, inputs, outputs, mounts):
"""Return a dictionary of environment variables for the container."""
env = {}
env.update(providers_util.get_file_environment_variables(inputs))
env.update(providers_util.get_file_environment_variables(outputs))
env.update(providers_util.get_file... | [
"Return",
"a",
"dictionary",
"of",
"environment",
"variables",
"for",
"the",
"container",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L779-L785 | [
"def",
"_make_environment",
"(",
"self",
",",
"inputs",
",",
"outputs",
",",
"mounts",
")",
":",
"env",
"=",
"{",
"}",
"env",
".",
"update",
"(",
"providers_util",
".",
"get_file_environment_variables",
"(",
"inputs",
")",
")",
"env",
".",
"update",
"(",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | LocalJobProvider._localize_inputs_recursive_command | Returns a command that will stage recursive inputs. | dsub/providers/local.py | def _localize_inputs_recursive_command(self, task_dir, inputs):
"""Returns a command that will stage recursive inputs."""
data_dir = os.path.join(task_dir, _DATA_SUBDIR)
provider_commands = [
providers_util.build_recursive_localize_command(data_dir, inputs,
... | def _localize_inputs_recursive_command(self, task_dir, inputs):
"""Returns a command that will stage recursive inputs."""
data_dir = os.path.join(task_dir, _DATA_SUBDIR)
provider_commands = [
providers_util.build_recursive_localize_command(data_dir, inputs,
... | [
"Returns",
"a",
"command",
"that",
"will",
"stage",
"recursive",
"inputs",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L787-L795 | [
"def",
"_localize_inputs_recursive_command",
"(",
"self",
",",
"task_dir",
",",
"inputs",
")",
":",
"data_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"task_dir",
",",
"_DATA_SUBDIR",
")",
"provider_commands",
"=",
"[",
"providers_util",
".",
"build_recursive... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | LocalJobProvider._get_input_target_path | Returns a directory or file path to be the target for "gsutil cp".
If the filename contains a wildcard, then the target path must
be a directory in order to ensure consistency whether the source pattern
contains one or multiple files.
Args:
local_file_path: A full path terminating in a file or ... | dsub/providers/local.py | def _get_input_target_path(self, local_file_path):
"""Returns a directory or file path to be the target for "gsutil cp".
If the filename contains a wildcard, then the target path must
be a directory in order to ensure consistency whether the source pattern
contains one or multiple files.
Args:
... | def _get_input_target_path(self, local_file_path):
"""Returns a directory or file path to be the target for "gsutil cp".
If the filename contains a wildcard, then the target path must
be a directory in order to ensure consistency whether the source pattern
contains one or multiple files.
Args:
... | [
"Returns",
"a",
"directory",
"or",
"file",
"path",
"to",
"be",
"the",
"target",
"for",
"gsutil",
"cp",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L797-L816 | [
"def",
"_get_input_target_path",
"(",
"self",
",",
"local_file_path",
")",
":",
"path",
",",
"filename",
"=",
"os",
".",
"path",
".",
"split",
"(",
"local_file_path",
")",
"if",
"'*'",
"in",
"filename",
":",
"return",
"path",
"+",
"'/'",
"else",
":",
"re... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | LocalJobProvider._localize_inputs_command | Returns a command that will stage inputs. | dsub/providers/local.py | def _localize_inputs_command(self, task_dir, inputs, user_project):
"""Returns a command that will stage inputs."""
commands = []
for i in inputs:
if i.recursive or not i.value:
continue
source_file_path = i.uri
local_file_path = task_dir + '/' + _DATA_SUBDIR + '/' + i.docker_path... | def _localize_inputs_command(self, task_dir, inputs, user_project):
"""Returns a command that will stage inputs."""
commands = []
for i in inputs:
if i.recursive or not i.value:
continue
source_file_path = i.uri
local_file_path = task_dir + '/' + _DATA_SUBDIR + '/' + i.docker_path... | [
"Returns",
"a",
"command",
"that",
"will",
"stage",
"inputs",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L818-L847 | [
"def",
"_localize_inputs_command",
"(",
"self",
",",
"task_dir",
",",
"inputs",
",",
"user_project",
")",
":",
"commands",
"=",
"[",
"]",
"for",
"i",
"in",
"inputs",
":",
"if",
"i",
".",
"recursive",
"or",
"not",
"i",
".",
"value",
":",
"continue",
"so... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | LocalJobProvider._delocalize_outputs_commands | Copy outputs from local disk to GCS. | dsub/providers/local.py | def _delocalize_outputs_commands(self, task_dir, outputs, user_project):
"""Copy outputs from local disk to GCS."""
commands = []
for o in outputs:
if o.recursive or not o.value:
continue
# The destination path is o.uri.path, which is the target directory
# (rather than o.uri, whi... | def _delocalize_outputs_commands(self, task_dir, outputs, user_project):
"""Copy outputs from local disk to GCS."""
commands = []
for o in outputs:
if o.recursive or not o.value:
continue
# The destination path is o.uri.path, which is the target directory
# (rather than o.uri, whi... | [
"Copy",
"outputs",
"from",
"local",
"disk",
"to",
"GCS",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L875-L899 | [
"def",
"_delocalize_outputs_commands",
"(",
"self",
",",
"task_dir",
",",
"outputs",
",",
"user_project",
")",
":",
"commands",
"=",
"[",
"]",
"for",
"o",
"in",
"outputs",
":",
"if",
"o",
".",
"recursive",
"or",
"not",
"o",
".",
"value",
":",
"continue",... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | get_dsub_version | Get the dsub version out of the _dsub_version.py source file.
Setup.py should not import dsub version from dsub directly since ambiguity in
import order could lead to an old version of dsub setting the version number.
Parsing the file directly is simpler than using import tools (whose interface
varies between ... | setup.py | def get_dsub_version():
"""Get the dsub version out of the _dsub_version.py source file.
Setup.py should not import dsub version from dsub directly since ambiguity in
import order could lead to an old version of dsub setting the version number.
Parsing the file directly is simpler than using import tools (whos... | def get_dsub_version():
"""Get the dsub version out of the _dsub_version.py source file.
Setup.py should not import dsub version from dsub directly since ambiguity in
import order could lead to an old version of dsub setting the version number.
Parsing the file directly is simpler than using import tools (whos... | [
"Get",
"the",
"dsub",
"version",
"out",
"of",
"the",
"_dsub_version",
".",
"py",
"source",
"file",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/setup.py#L25-L46 | [
"def",
"get_dsub_version",
"(",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'dsub/_dsub_version.py'",
")",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"versi... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2EventMap.get_filtered_normalized_events | Filter the granular v2 events down to events of interest.
Filter through the large number of granular events returned by the
pipelines API, and extract only those that are interesting to a user. This
is implemented by filtering out events which are known to be uninteresting
(i.e. the default actions ru... | dsub/providers/google_v2.py | def get_filtered_normalized_events(self):
"""Filter the granular v2 events down to events of interest.
Filter through the large number of granular events returned by the
pipelines API, and extract only those that are interesting to a user. This
is implemented by filtering out events which are known to ... | def get_filtered_normalized_events(self):
"""Filter the granular v2 events down to events of interest.
Filter through the large number of granular events returned by the
pipelines API, and extract only those that are interesting to a user. This
is implemented by filtering out events which are known to ... | [
"Filter",
"the",
"granular",
"v2",
"events",
"down",
"to",
"events",
"of",
"interest",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L357-L403 | [
"def",
"get_filtered_normalized_events",
"(",
"self",
")",
":",
"# Need the user-image to look for the right \"pulling image\" event",
"user_image",
"=",
"google_v2_operations",
".",
"get_action_image",
"(",
"self",
".",
"_op",
",",
"_ACTION_USER_COMMAND",
")",
"# Only create a... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2EventMap._map | Extract elements from an operation event and map to a named event. | dsub/providers/google_v2.py | def _map(self, event):
"""Extract elements from an operation event and map to a named event."""
description = event.get('description', '')
start_time = google_base.parse_rfc3339_utc_string(
event.get('timestamp', ''))
for name, regex in _EVENT_REGEX_MAP.items():
match = regex.match(descri... | def _map(self, event):
"""Extract elements from an operation event and map to a named event."""
description = event.get('description', '')
start_time = google_base.parse_rfc3339_utc_string(
event.get('timestamp', ''))
for name, regex in _EVENT_REGEX_MAP.items():
match = regex.match(descri... | [
"Extract",
"elements",
"from",
"an",
"operation",
"event",
"and",
"map",
"to",
"a",
"named",
"event",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L405-L416 | [
"def",
"_map",
"(",
"self",
",",
"event",
")",
":",
"description",
"=",
"event",
".",
"get",
"(",
"'description'",
",",
"''",
")",
"start_time",
"=",
"google_base",
".",
"parse_rfc3339_utc_string",
"(",
"event",
".",
"get",
"(",
"'timestamp'",
",",
"''",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2JobProvider._get_logging_env | Returns the environment for actions that copy logging files. | dsub/providers/google_v2.py | def _get_logging_env(self, logging_uri, user_project):
"""Returns the environment for actions that copy logging files."""
if not logging_uri.endswith('.log'):
raise ValueError('Logging URI must end in ".log": {}'.format(logging_uri))
logging_prefix = logging_uri[:-len('.log')]
return {
'L... | def _get_logging_env(self, logging_uri, user_project):
"""Returns the environment for actions that copy logging files."""
if not logging_uri.endswith('.log'):
raise ValueError('Logging URI must end in ".log": {}'.format(logging_uri))
logging_prefix = logging_uri[:-len('.log')]
return {
'L... | [
"Returns",
"the",
"environment",
"for",
"actions",
"that",
"copy",
"logging",
"files",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L468-L479 | [
"def",
"_get_logging_env",
"(",
"self",
",",
"logging_uri",
",",
"user_project",
")",
":",
"if",
"not",
"logging_uri",
".",
"endswith",
"(",
"'.log'",
")",
":",
"raise",
"ValueError",
"(",
"'Logging URI must end in \".log\": {}'",
".",
"format",
"(",
"logging_uri"... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2JobProvider._get_prepare_env | Return a dict with variables for the 'prepare' action. | dsub/providers/google_v2.py | def _get_prepare_env(self, script, job_descriptor, inputs, outputs, mounts):
"""Return a dict with variables for the 'prepare' action."""
# Add the _SCRIPT_REPR with the repr(script) contents
# Add the _META_YAML_REPR with the repr(meta) contents
# Add variables for directories that need to be created... | def _get_prepare_env(self, script, job_descriptor, inputs, outputs, mounts):
"""Return a dict with variables for the 'prepare' action."""
# Add the _SCRIPT_REPR with the repr(script) contents
# Add the _META_YAML_REPR with the repr(meta) contents
# Add variables for directories that need to be created... | [
"Return",
"a",
"dict",
"with",
"variables",
"for",
"the",
"prepare",
"action",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L481-L516 | [
"def",
"_get_prepare_env",
"(",
"self",
",",
"script",
",",
"job_descriptor",
",",
"inputs",
",",
"outputs",
",",
"mounts",
")",
":",
"# Add the _SCRIPT_REPR with the repr(script) contents",
"# Add the _META_YAML_REPR with the repr(meta) contents",
"# Add variables for directorie... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2JobProvider._get_localization_env | Return a dict with variables for the 'localization' action. | dsub/providers/google_v2.py | def _get_localization_env(self, inputs, user_project):
"""Return a dict with variables for the 'localization' action."""
# Add variables for paths that need to be localized, for example:
# INPUT_COUNT: 1
# INPUT_0: MY_INPUT_FILE
# INPUT_RECURSIVE_0: 0
# INPUT_SRC_0: gs://mybucket/mypath/myfile
... | def _get_localization_env(self, inputs, user_project):
"""Return a dict with variables for the 'localization' action."""
# Add variables for paths that need to be localized, for example:
# INPUT_COUNT: 1
# INPUT_0: MY_INPUT_FILE
# INPUT_RECURSIVE_0: 0
# INPUT_SRC_0: gs://mybucket/mypath/myfile
... | [
"Return",
"a",
"dict",
"with",
"variables",
"for",
"the",
"localization",
"action",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L518-L545 | [
"def",
"_get_localization_env",
"(",
"self",
",",
"inputs",
",",
"user_project",
")",
":",
"# Add variables for paths that need to be localized, for example:",
"# INPUT_COUNT: 1",
"# INPUT_0: MY_INPUT_FILE",
"# INPUT_RECURSIVE_0: 0",
"# INPUT_SRC_0: gs://mybucket/mypath/myfile",
"# INP... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2JobProvider._get_delocalization_env | Return a dict with variables for the 'delocalization' action. | dsub/providers/google_v2.py | def _get_delocalization_env(self, outputs, user_project):
"""Return a dict with variables for the 'delocalization' action."""
# Add variables for paths that need to be delocalized, for example:
# OUTPUT_COUNT: 1
# OUTPUT_0: MY_OUTPUT_FILE
# OUTPUT_RECURSIVE_0: 0
# OUTPUT_SRC_0: gs://mybucket/my... | def _get_delocalization_env(self, outputs, user_project):
"""Return a dict with variables for the 'delocalization' action."""
# Add variables for paths that need to be delocalized, for example:
# OUTPUT_COUNT: 1
# OUTPUT_0: MY_OUTPUT_FILE
# OUTPUT_RECURSIVE_0: 0
# OUTPUT_SRC_0: gs://mybucket/my... | [
"Return",
"a",
"dict",
"with",
"variables",
"for",
"the",
"delocalization",
"action",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L547-L575 | [
"def",
"_get_delocalization_env",
"(",
"self",
",",
"outputs",
",",
"user_project",
")",
":",
"# Add variables for paths that need to be delocalized, for example:",
"# OUTPUT_COUNT: 1",
"# OUTPUT_0: MY_OUTPUT_FILE",
"# OUTPUT_RECURSIVE_0: 0",
"# OUTPUT_SRC_0: gs://mybucket/mypath/myfile"... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2JobProvider._build_user_environment | Returns a dictionary of for the user container environment. | dsub/providers/google_v2.py | def _build_user_environment(self, envs, inputs, outputs, mounts):
"""Returns a dictionary of for the user container environment."""
envs = {env.name: env.value for env in envs}
envs.update(providers_util.get_file_environment_variables(inputs))
envs.update(providers_util.get_file_environment_variables(ou... | def _build_user_environment(self, envs, inputs, outputs, mounts):
"""Returns a dictionary of for the user container environment."""
envs = {env.name: env.value for env in envs}
envs.update(providers_util.get_file_environment_variables(inputs))
envs.update(providers_util.get_file_environment_variables(ou... | [
"Returns",
"a",
"dictionary",
"of",
"for",
"the",
"user",
"container",
"environment",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L577-L583 | [
"def",
"_build_user_environment",
"(",
"self",
",",
"envs",
",",
"inputs",
",",
"outputs",
",",
"mounts",
")",
":",
"envs",
"=",
"{",
"env",
".",
"name",
":",
"env",
".",
"value",
"for",
"env",
"in",
"envs",
"}",
"envs",
".",
"update",
"(",
"provider... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2JobProvider._get_mount_actions | Returns a list of two actions per gcs bucket to mount. | dsub/providers/google_v2.py | def _get_mount_actions(self, mounts, mnt_datadisk):
"""Returns a list of two actions per gcs bucket to mount."""
actions_to_add = []
for mount in mounts:
bucket = mount.value[len('gs://'):]
mount_path = mount.docker_path
actions_to_add.extend([
google_v2_pipelines.build_action(
... | def _get_mount_actions(self, mounts, mnt_datadisk):
"""Returns a list of two actions per gcs bucket to mount."""
actions_to_add = []
for mount in mounts:
bucket = mount.value[len('gs://'):]
mount_path = mount.docker_path
actions_to_add.extend([
google_v2_pipelines.build_action(
... | [
"Returns",
"a",
"list",
"of",
"two",
"actions",
"per",
"gcs",
"bucket",
"to",
"mount",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L585-L611 | [
"def",
"_get_mount_actions",
"(",
"self",
",",
"mounts",
",",
"mnt_datadisk",
")",
":",
"actions_to_add",
"=",
"[",
"]",
"for",
"mount",
"in",
"mounts",
":",
"bucket",
"=",
"mount",
".",
"value",
"[",
"len",
"(",
"'gs://'",
")",
":",
"]",
"mount_path",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2JobProvider._build_pipeline_request | Returns a Pipeline objects for the task. | dsub/providers/google_v2.py | def _build_pipeline_request(self, task_view):
"""Returns a Pipeline objects for the task."""
job_metadata = task_view.job_metadata
job_params = task_view.job_params
job_resources = task_view.job_resources
task_metadata = task_view.task_descriptors[0].task_metadata
task_params = task_view.task_de... | def _build_pipeline_request(self, task_view):
"""Returns a Pipeline objects for the task."""
job_metadata = task_view.job_metadata
job_params = task_view.job_params
job_resources = task_view.job_resources
task_metadata = task_view.task_descriptors[0].task_metadata
task_params = task_view.task_de... | [
"Returns",
"a",
"Pipeline",
"objects",
"for",
"the",
"task",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L613-L862 | [
"def",
"_build_pipeline_request",
"(",
"self",
",",
"task_view",
")",
":",
"job_metadata",
"=",
"task_view",
".",
"job_metadata",
"job_params",
"=",
"task_view",
".",
"job_params",
"job_resources",
"=",
"task_view",
".",
"job_resources",
"task_metadata",
"=",
"task_... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2JobProvider.submit_job | Submit the job (or tasks) to be executed.
Args:
job_descriptor: all parameters needed to launch all job tasks
skip_if_output_present: (boolean) if true, skip tasks whose output
is present (see --skip flag for more explanation).
Returns:
A dictionary containing the 'user-id', 'job-id'... | dsub/providers/google_v2.py | def submit_job(self, job_descriptor, skip_if_output_present):
"""Submit the job (or tasks) to be executed.
Args:
job_descriptor: all parameters needed to launch all job tasks
skip_if_output_present: (boolean) if true, skip tasks whose output
is present (see --skip flag for more explanation)... | def submit_job(self, job_descriptor, skip_if_output_present):
"""Submit the job (or tasks) to be executed.
Args:
job_descriptor: all parameters needed to launch all job tasks
skip_if_output_present: (boolean) if true, skip tasks whose output
is present (see --skip flag for more explanation)... | [
"Submit",
"the",
"job",
"(",
"or",
"tasks",
")",
"to",
"be",
"executed",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L872-L931 | [
"def",
"submit_job",
"(",
"self",
",",
"job_descriptor",
",",
"skip_if_output_present",
")",
":",
"# Validate task data and resources.",
"param_util",
".",
"validate_submit_args_or_fail",
"(",
"job_descriptor",
",",
"provider_name",
"=",
"_PROVIDER_NAME",
",",
"input_provid... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2JobProvider._operations_list | Gets the list of operations for the specified filter.
Args:
ops_filter: string filter of operations to return
max_tasks: the maximum number of job tasks to return or 0 for no limit.
page_size: the number of operations to requested on each list operation to
the pipelines API (if 0 or None,... | dsub/providers/google_v2.py | def _operations_list(self, ops_filter, max_tasks, page_size, page_token):
"""Gets the list of operations for the specified filter.
Args:
ops_filter: string filter of operations to return
max_tasks: the maximum number of job tasks to return or 0 for no limit.
page_size: the number of operation... | def _operations_list(self, ops_filter, max_tasks, page_size, page_token):
"""Gets the list of operations for the specified filter.
Args:
ops_filter: string filter of operations to return
max_tasks: the maximum number of job tasks to return or 0 for no limit.
page_size: the number of operation... | [
"Gets",
"the",
"list",
"of",
"operations",
"for",
"the",
"specified",
"filter",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L1029-L1064 | [
"def",
"_operations_list",
"(",
"self",
",",
"ops_filter",
",",
"max_tasks",
",",
"page_size",
",",
"page_token",
")",
":",
"# We are not using the documented default page size of 256,",
"# nor allowing for the maximum page size of 2048 as larger page sizes",
"# currently cause the o... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2JobProvider.lookup_job_tasks | Yields operations based on the input criteria.
If any of the filters are empty or {'*'}, then no filtering is performed on
that field. Filtering by both a job id list and job name list is
unsupported.
Args:
statuses: {'*'}, or a list of job status strings to return. Valid
status strings ... | dsub/providers/google_v2.py | def lookup_job_tasks(self,
statuses,
user_ids=None,
job_ids=None,
job_names=None,
task_ids=None,
task_attempts=None,
labels=None,
create... | def lookup_job_tasks(self,
statuses,
user_ids=None,
job_ids=None,
job_names=None,
task_ids=None,
task_attempts=None,
labels=None,
create... | [
"Yields",
"operations",
"based",
"on",
"the",
"input",
"criteria",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L1066-L1132 | [
"def",
"lookup_job_tasks",
"(",
"self",
",",
"statuses",
",",
"user_ids",
"=",
"None",
",",
"job_ids",
"=",
"None",
",",
"job_names",
"=",
"None",
",",
"task_ids",
"=",
"None",
",",
"task_attempts",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"create_t... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleOperation._operation_status | Returns the status of this operation.
Raises:
ValueError: if the operation status cannot be determined.
Returns:
A printable status string (RUNNING, SUCCESS, CANCELED or FAILURE). | dsub/providers/google_v2.py | def _operation_status(self):
"""Returns the status of this operation.
Raises:
ValueError: if the operation status cannot be determined.
Returns:
A printable status string (RUNNING, SUCCESS, CANCELED or FAILURE).
"""
if not google_v2_operations.is_done(self._op):
return 'RUNNING'
... | def _operation_status(self):
"""Returns the status of this operation.
Raises:
ValueError: if the operation status cannot be determined.
Returns:
A printable status string (RUNNING, SUCCESS, CANCELED or FAILURE).
"""
if not google_v2_operations.is_done(self._op):
return 'RUNNING'
... | [
"Returns",
"the",
"status",
"of",
"this",
"operation",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L1204-L1223 | [
"def",
"_operation_status",
"(",
"self",
")",
":",
"if",
"not",
"google_v2_operations",
".",
"is_done",
"(",
"self",
".",
"_op",
")",
":",
"return",
"'RUNNING'",
"if",
"google_v2_operations",
".",
"is_success",
"(",
"self",
".",
"_op",
")",
":",
"return",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleOperation._operation_status_message | Returns the most relevant status string and failed action.
This string is meant for display only.
Returns:
A printable status string and name of failed action (if any). | dsub/providers/google_v2.py | def _operation_status_message(self):
"""Returns the most relevant status string and failed action.
This string is meant for display only.
Returns:
A printable status string and name of failed action (if any).
"""
msg = None
action = None
if not google_v2_operations.is_done(self._op):... | def _operation_status_message(self):
"""Returns the most relevant status string and failed action.
This string is meant for display only.
Returns:
A printable status string and name of failed action (if any).
"""
msg = None
action = None
if not google_v2_operations.is_done(self._op):... | [
"Returns",
"the",
"most",
"relevant",
"status",
"string",
"and",
"failed",
"action",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L1225-L1259 | [
"def",
"_operation_status_message",
"(",
"self",
")",
":",
"msg",
"=",
"None",
"action",
"=",
"None",
"if",
"not",
"google_v2_operations",
".",
"is_done",
"(",
"self",
".",
"_op",
")",
":",
"last_event",
"=",
"google_v2_operations",
".",
"get_last_event",
"(",... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleOperation.error_message | Returns an error message if the operation failed for any reason.
Failure as defined here means ended for any reason other than 'success'.
This means that a successful cancelation will also return an error message.
Returns:
string, string will be empty if job did not error. | dsub/providers/google_v2.py | def error_message(self):
"""Returns an error message if the operation failed for any reason.
Failure as defined here means ended for any reason other than 'success'.
This means that a successful cancelation will also return an error message.
Returns:
string, string will be empty if job did not e... | def error_message(self):
"""Returns an error message if the operation failed for any reason.
Failure as defined here means ended for any reason other than 'success'.
This means that a successful cancelation will also return an error message.
Returns:
string, string will be empty if job did not e... | [
"Returns",
"an",
"error",
"message",
"if",
"the",
"operation",
"failed",
"for",
"any",
"reason",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L1261-L1280 | [
"def",
"error_message",
"(",
"self",
")",
":",
"error",
"=",
"google_v2_operations",
".",
"get_error",
"(",
"self",
".",
"_op",
")",
"if",
"error",
":",
"job_id",
"=",
"self",
".",
"get_field",
"(",
"'job-id'",
")",
"task_id",
"=",
"self",
".",
"get_fiel... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleOperation.get_field | Returns a value from the operation for a specific set of field names.
Args:
field: a dsub-specific job metadata key
default: default value to return if field does not exist or is empty.
Returns:
A text string for the field or a list for 'inputs'.
Raises:
ValueError: if the field l... | dsub/providers/google_v2.py | def get_field(self, field, default=None):
"""Returns a value from the operation for a specific set of field names.
Args:
field: a dsub-specific job metadata key
default: default value to return if field does not exist or is empty.
Returns:
A text string for the field or a list for 'input... | def get_field(self, field, default=None):
"""Returns a value from the operation for a specific set of field names.
Args:
field: a dsub-specific job metadata key
default: default value to return if field does not exist or is empty.
Returns:
A text string for the field or a list for 'input... | [
"Returns",
"a",
"value",
"from",
"the",
"operation",
"for",
"a",
"specific",
"set",
"of",
"field",
"names",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L1282-L1419 | [
"def",
"get_field",
"(",
"self",
",",
"field",
",",
"default",
"=",
"None",
")",
":",
"value",
"=",
"None",
"if",
"field",
"==",
"'internal-id'",
":",
"value",
"=",
"self",
".",
"_op",
"[",
"'name'",
"]",
"elif",
"field",
"==",
"'user-project'",
":",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2CustomMachine._validate_ram | Rounds ram up to the nearest multiple of _MEMORY_MULTIPLE. | dsub/providers/google_v2.py | def _validate_ram(ram_in_mb):
"""Rounds ram up to the nearest multiple of _MEMORY_MULTIPLE."""
return int(GoogleV2CustomMachine._MEMORY_MULTIPLE * math.ceil(
ram_in_mb / GoogleV2CustomMachine._MEMORY_MULTIPLE)) | def _validate_ram(ram_in_mb):
"""Rounds ram up to the nearest multiple of _MEMORY_MULTIPLE."""
return int(GoogleV2CustomMachine._MEMORY_MULTIPLE * math.ceil(
ram_in_mb / GoogleV2CustomMachine._MEMORY_MULTIPLE)) | [
"Rounds",
"ram",
"up",
"to",
"the",
"nearest",
"multiple",
"of",
"_MEMORY_MULTIPLE",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L1445-L1448 | [
"def",
"_validate_ram",
"(",
"ram_in_mb",
")",
":",
"return",
"int",
"(",
"GoogleV2CustomMachine",
".",
"_MEMORY_MULTIPLE",
"*",
"math",
".",
"ceil",
"(",
"ram_in_mb",
"/",
"GoogleV2CustomMachine",
".",
"_MEMORY_MULTIPLE",
")",
")"
] | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | GoogleV2CustomMachine.build_machine_type | Returns a custom machine type string. | dsub/providers/google_v2.py | def build_machine_type(cls, min_cores, min_ram):
"""Returns a custom machine type string."""
min_cores = min_cores or job_model.DEFAULT_MIN_CORES
min_ram = min_ram or job_model.DEFAULT_MIN_RAM
# First, min_ram is given in GB. Convert to MB.
min_ram *= GoogleV2CustomMachine._MB_PER_GB
# Only ma... | def build_machine_type(cls, min_cores, min_ram):
"""Returns a custom machine type string."""
min_cores = min_cores or job_model.DEFAULT_MIN_CORES
min_ram = min_ram or job_model.DEFAULT_MIN_RAM
# First, min_ram is given in GB. Convert to MB.
min_ram *= GoogleV2CustomMachine._MB_PER_GB
# Only ma... | [
"Returns",
"a",
"custom",
"machine",
"type",
"string",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2.py#L1451-L1482 | [
"def",
"build_machine_type",
"(",
"cls",
",",
"min_cores",
",",
"min_ram",
")",
":",
"min_cores",
"=",
"min_cores",
"or",
"job_model",
".",
"DEFAULT_MIN_CORES",
"min_ram",
"=",
"min_ram",
"or",
"job_model",
".",
"DEFAULT_MIN_RAM",
"# First, min_ram is given in GB. Con... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
valid | build_machine | Build a VirtualMachine object for a Pipeline request.
Args:
network (dict): Network details for the pipeline to run in.
machine_type (str): GCE Machine Type string for the pipeline.
preemptible (bool): Use a preemptible VM for the job.
service_account (dict): Service account configuration for the VM.... | dsub/providers/google_v2_pipelines.py | def build_machine(network=None,
machine_type=None,
preemptible=None,
service_account=None,
boot_disk_size_gb=None,
disks=None,
accelerators=None,
labels=None,
cpu_platform=None... | def build_machine(network=None,
machine_type=None,
preemptible=None,
service_account=None,
boot_disk_size_gb=None,
disks=None,
accelerators=None,
labels=None,
cpu_platform=None... | [
"Build",
"a",
"VirtualMachine",
"object",
"for",
"a",
"Pipeline",
"request",
"."
] | DataBiosphere/dsub | python | https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/google_v2_pipelines.py#L50-L89 | [
"def",
"build_machine",
"(",
"network",
"=",
"None",
",",
"machine_type",
"=",
"None",
",",
"preemptible",
"=",
"None",
",",
"service_account",
"=",
"None",
",",
"boot_disk_size_gb",
"=",
"None",
",",
"disks",
"=",
"None",
",",
"accelerators",
"=",
"None",
... | 443ce31daa6023dc2fd65ef2051796e19d18d5a7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.