index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
45,689 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/triples.py | 43,44 | 28,53 | set_peek | Triples | 45,53 | 44,53 | class Triples(data.Data):
"""
The abstract base class for the file format that can contain triples
"""
edam_data = "data_0582"
edam_format = "format_2376"
file_ext = "triples"
def sniff(self, filename: str) -> bool:
"""
Returns false and the user must manually set.
... | class Triples(data.Data):
"""
The abstract base class for the file format that can contain triples
"""
edam_data = "data_0582"
edam_format = "format_2376"
file_ext = "triples"
def sniff(self, filename: str) -> bool:
"""
Returns false and the user must manually set.
... | if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "Triple data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
| """Set the peek and blurb text"""
if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "Triple data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
| 23 | 156 | 88 | 244 | """
Triple format classes
"""
import logging
import re
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import DatasetProtocol
from galaxy.datatypes.sniff import (
build_sniff_from_prefix,
FilePrefix,
)
from . import (
binary,
data,
text,
xml,
)
log = logg... | """
Triple format classes
"""
import logging
import re
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import DatasetProtocol
from galaxy.datatypes.sniff import (
build_sniff_from_prefix,
FilePrefix,
)
from . import (
binary,
data,
text,
xml,
)
log = logg... |
45,690 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/triples.py | 120,121 | 102,131 | set_peek | Turtle | 122,131 | 121,131 | @build_sniff_from_prefix
class Turtle(data.Text, Triples):
"""
The Turtle triple data format
"""
edam_format = "format_3255"
file_ext = "ttl"
def sniff_prefix(self, file_prefix: FilePrefix) -> bool:
# @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
if file_prefix.s... | @build_sniff_from_prefix
class Turtle(data.Text, Triples):
"""
The Turtle triple data format
"""
edam_format = "format_3255"
file_ext = "ttl"
def sniff_prefix(self, file_prefix: FilePrefix) -> bool:
# @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
if file_prefix.s... | if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "Turtle triple data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
# TODO: we might want to look at rdflib or a... | """Set the peek and blurb text"""
if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "Turtle triple data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
# ... | 38 | 226 | 113 | 339 | """
Triple format classes
"""
import logging
import re
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import DatasetProtocol
from galaxy.datatypes.sniff import (
build_sniff_from_prefix,
FilePrefix,
)
from . import (
binary,
data,
text,
xml,
)
log = logg... | """
Triple format classes
"""
import logging
import re
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import DatasetProtocol
from galaxy.datatypes.sniff import (
build_sniff_from_prefix,
FilePrefix,
)
from . import (
binary,
data,
text,
xml,
)
log = logg... |
45,691 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/upload_util.py | 28,42 | 1,119 | handle_upload | 42,119 | 42,119 | import os
from typing import (
NamedTuple,
Optional,
)
from galaxy.datatypes import (
data,
sniff,
)
from galaxy.util.checkers import is_single_file_zip
class UploadProblemException(Exception):
pass
class HandleUploadResponse(NamedTuple):
stdout: Optional[str]
ext: str
datatype: dat... | import os
from typing import (
NamedTuple,
Optional,
)
from galaxy.datatypes import (
data,
sniff,
)
from galaxy.util.checkers import is_single_file_zip
class UploadProblemException(Exception):
pass
class HandleUploadResponse(NamedTuple):
stdout: Optional[str]
ext: str
datatype: dat... | stdout = None
converted_path = None
multi_file_zip = False
# Does the first 1MB look like binary content?
file_prefix = sniff.FilePrefix(path, auto_decompress=auto_decompress)
is_binary = file_prefix.binary
converted_newlines, converted_spaces = False, False
# Decompress if needed/des... | stdout = None
converted_path = None
multi_file_zip = False
# Does the first 1MB look like binary content?
file_prefix = sniff.FilePrefix(path, auto_decompress=auto_decompress)
is_binary = file_prefix.binary
converted_newlines, converted_spaces = False, False
# Decompress if needed/des... | 333 | 291 | 1,060 | 1,351 | import os
from typing import (
NamedTuple,
Optional,
)
from galaxy.datatypes import (
data,
sniff,
)
from galaxy.util.checkers import is_single_file_zip
class UploadProblemException(Exception):
pass
class HandleUploadResponse(NamedTuple):
stdout: Optional[str]
ext: str
datatype: dat... | import os
from typing import (
NamedTuple,
Optional,
)
from galaxy.datatypes import (
data,
sniff,
)
from galaxy.util.checkers import is_single_file_zip
class UploadProblemException(Exception):
pass
class HandleUploadResponse(NamedTuple):
stdout: Optional[str]
ext: str
datatype: dat... | |
45,692 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/util/generic_util.py | 4,5 | 1,19 | count_special_lines | 10,19 | 5,19 | from galaxy.util import commands
def count_special_lines(word, filename, invert=False):
FILL_FUNC_BODY | from galaxy.util import commands
def count_special_lines(word, filename, invert=False):
"""
searching for special 'words' using the grep tool
grep is used to speed up the searching and counting
The number of hits is returned.
"""
FILL_FUNC_BODY | cmd = ["grep", "-c", "-E"]
if invert:
cmd.append("-v")
cmd.extend([word, filename])
try:
out = commands.execute(cmd)
except commands.CommandLineException:
return 0
return int(out)
| """
searching for special 'words' using the grep tool
grep is used to speed up the searching and counting
The number of hits is returned.
"""
cmd = ["grep", "-c", "-E"]
if invert:
cmd.append("-v")
cmd.extend([word, filename])
try:
out = commands.execute(cmd)
excep... | 20 | 74 | 82 | 156 | from galaxy.util import commands
def count_special_lines(word, filename, invert=False):
FILL_FUNC_BODY | from galaxy.util import commands
def count_special_lines(word, filename, invert=False):
"""
searching for special 'words' using the grep tool
grep is used to speed up the searching and counting
The number of hits is returned.
"""
FILL_FUNC_BODY | |
45,693 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/xml.py | 107,108 | 101,117 | set_peek | CisML | 109,117 | 108,117 | @disable_parent_class_sniffing
class CisML(GenericXml):
"""CisML XML data""" # see: http://www.ncbi.nlm.nih.gov/pubmed/15001475
file_ext = "cisml"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
FILL_FUNC_BODY | @disable_parent_class_sniffing
class CisML(GenericXml):
"""CisML XML data""" # see: http://www.ncbi.nlm.nih.gov/pubmed/15001475
file_ext = "cisml"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
"""Set the peek and blurb text"""
FILL_FUNC_BODY | if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "CisML data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
| """Set the peek and blurb text"""
if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "CisML data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
| 23 | 118 | 89 | 207 | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... |
45,694 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/xml.py | 151,152 | 117,194 | set_meta | Dzi | 152,168 | 152,168 | class Dzi(GenericXml):
"""
Deep zoom image format, see
https://github.com/openseadragon/openseadragon/wiki/The-DZI-File-Format
"""
# General elements.
MetadataElement(
name="base_name", desc="Base name for this dataset", default="DeepZoomImage", readonly=True, set_in_upload=True
)
... | class Dzi(GenericXml):
"""
Deep zoom image format, see
https://github.com/openseadragon/openseadragon/wiki/The-DZI-File-Format
"""
# General elements.
MetadataElement(
name="base_name", desc="Base name for this dataset", default="DeepZoomImage", readonly=True, set_in_upload=True
)
... | tree = util.parse_xml(dataset.get_file_name())
root = tree.getroot()
dataset.metadata.format = root.get("Format")
dataset.metadata.tile_size = root.get("TileSize")
# DeepZoom image files can include
# xml namespace attributes.
if root.tag.find("Collection") >= 0:
... | tree = util.parse_xml(dataset.get_file_name())
root = tree.getroot()
dataset.metadata.format = root.get("Format")
dataset.metadata.tile_size = root.get("TileSize")
# DeepZoom image files can include
# xml namespace attributes.
if root.tag.find("Collection") >= 0:
... | 53 | 761 | 218 | 979 | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... |
45,695 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/xml.py | 38,39 | 30,85 | set_peek | GenericXml | 40,47 | 39,47 | @dataproviders.decorators.has_dataproviders
@build_sniff_from_prefix
class GenericXml(data.Text):
"""Base format class for any XML file."""
edam_format = "format_2332"
file_ext = "xml"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
FILL_FUNC_BODY def _has_root_element_in_prefix(self, ... | @dataproviders.decorators.has_dataproviders
@build_sniff_from_prefix
class GenericXml(data.Text):
"""Base format class for any XML file."""
edam_format = "format_2332"
file_ext = "xml"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
"""Set the peek and blurb text"""
FILL_FUNC_BODY... | if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "XML data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
| """Set the peek and blurb text"""
if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "XML data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
| 23 | 592 | 85 | 677 | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... |
45,696 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/xml.py | 91,92 | 85,101 | set_peek | MEMEXml | 93,101 | 92,101 | @disable_parent_class_sniffing
class MEMEXml(GenericXml):
"""MEME XML Output data"""
file_ext = "memexml"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
FILL_FUNC_BODY | @disable_parent_class_sniffing
class MEMEXml(GenericXml):
"""MEME XML Output data"""
file_ext = "memexml"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
"""Set the peek and blurb text"""
FILL_FUNC_BODY | if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "MEME XML data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
| """Set the peek and blurb text"""
if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "MEME XML data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
| 24 | 89 | 89 | 178 | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... |
45,697 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/xml.py | 236,237 | 227,251 | set_peek | Owl | 237,244 | 237,244 | class Owl(GenericXml):
"""
Web Ontology Language OWL format description
http://www.w3.org/TR/owl-ref/
"""
edam_format = "format_3262"
file_ext = "owl"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
FILL_FUNC_BODY def sniff_prefix(self, file_prefix: FilePrefix) -> bool:
... | class Owl(GenericXml):
"""
Web Ontology Language OWL format description
http://www.w3.org/TR/owl-ref/
"""
edam_format = "format_3262"
file_ext = "owl"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
FILL_FUNC_BODY def sniff_prefix(self, file_prefix: FilePrefix) -> bool:
... | if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "Web Ontology Language OWL"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disc"
| if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "Web Ontology Language OWL"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disc"
| 25 | 167 | 90 | 257 | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... |
45,698 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/xml.py | 201,202 | 194,227 | set_peek | Phyloxml | 203,210 | 202,210 | class Phyloxml(GenericXml):
"""Format for defining phyloxml data http://www.phyloxml.org/"""
edam_data = "data_0872"
edam_format = "format_3159"
file_ext = "phyloxml"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
FILL_FUNC_BODY def sniff_prefix(self, file_prefix: FilePrefix) -> b... | class Phyloxml(GenericXml):
"""Format for defining phyloxml data http://www.phyloxml.org/"""
edam_data = "data_0872"
edam_format = "format_3159"
file_ext = "phyloxml"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
"""Set the peek and blurb text"""
FILL_FUNC_BODY def sniff_... | if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "Phyloxml data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
| """Set the peek and blurb text"""
if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "Phyloxml data"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
| 23 | 337 | 88 | 425 | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... |
45,699 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/xml.py | 261,262 | 251,274 | set_peek | Sbml | 262,269 | 262,269 | class Sbml(GenericXml):
"""
System Biology Markup Language
http://sbml.org
"""
file_ext = "sbml"
edam_data = "data_2024"
edam_format = "format_2585"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
FILL_FUNC_BODY def sniff_prefix(self, file_prefix: FilePrefix) -> bool:
... | class Sbml(GenericXml):
"""
System Biology Markup Language
http://sbml.org
"""
file_ext = "sbml"
edam_data = "data_2024"
edam_format = "format_2585"
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
FILL_FUNC_BODY def sniff_prefix(self, file_prefix: FilePrefix) -> bool:
... | if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "System Biology Markup Language SBML"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disc"
| if not dataset.dataset.purged:
dataset.peek = data.get_file_peek(dataset.get_file_name())
dataset.blurb = "System Biology Markup Language SBML"
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disc"
| 26 | 171 | 92 | 263 | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... | """
XML format classes
"""
import logging
import re
from typing import List
from galaxy import util
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.pr... |
45,700 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/di.py | 31,34 | 15,49 | _register_abstract_singleton | Container | 34,37 | 34,37 | class Container(LagomContainer):
"""Abstraction around lagom to provide a dependency injection context.
Abstractions used by Galaxy should come through this interface so we can swap
out the backend as needed. For instance https://punq.readthedocs.io/en/latest/
containers look very nice and would allow ... | class Container(LagomContainer):
"""Abstraction around lagom to provide a dependency injection context.
Abstractions used by Galaxy should come through this interface so we can swap
out the backend as needed. For instance https://punq.readthedocs.io/en/latest/
containers look very nice and would allow ... | self[abstract_type] = instance if instance is not None else concrete_type
return self[abstract_type]
| self[abstract_type] = instance if instance is not None else concrete_type
return self[abstract_type]
| 12 | 360 | 34 | 394 | """Dependency injection framework for Galaxy-type apps."""
from typing import (
Optional,
Type,
TypeVar,
)
from lagom import Container as LagomContainer
from lagom.exceptions import UnresolvableType
T = TypeVar("T")
class Container(LagomContainer):
"""Abstraction around lagom to provide a dependenc... | """Dependency injection framework for Galaxy-type apps."""
from typing import (
Optional,
Type,
TypeVar,
)
from lagom import Container as LagomContainer
from lagom.exceptions import UnresolvableType
T = TypeVar("T")
class Container(LagomContainer):
"""Abstraction around lagom to provide a dependenc... |
45,701 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/exceptions/error_codes.py | 38,39 | 1,55 | _from_dict | 40,46 | 39,46 | """Defines the :class:`ErrorCode` class and instantiates concrete objects from JSON.
See the file error_codes.json for actual error code descriptions.
"""
from json import loads
from typing import Dict
from galaxy.util.resources import resource_string
# Error codes are provided as a convience to Galaxy API clients,... | """Defines the :class:`ErrorCode` class and instantiates concrete objects from JSON.
See the file error_codes.json for actual error code descriptions.
"""
from json import loads
from typing import Dict
from galaxy.util.resources import resource_string
# Error codes are provided as a convience to Galaxy API clients,... | name = entry.get("name")
code = entry.get("code")
message = entry.get("message")
return (name, ErrorCode(code, message))
| """Build a :class:`ErrorCode` object from a JSON entry."""
name = entry.get("name")
code = entry.get("code")
message = entry.get("message")
return (name, ErrorCode(code, message))
| 13 | 526 | 51 | 577 | """Defines the :class:`ErrorCode` class and instantiates concrete objects from JSON.
See the file error_codes.json for actual error code descriptions.
"""
from json import loads
from typing import Dict
from galaxy.util.resources import resource_string
# Error codes are provided as a convience to Galaxy API clients,... | """Defines the :class:`ErrorCode` class and instantiates concrete objects from JSON.
See the file error_codes.json for actual error code descriptions.
"""
from json import loads
from typing import Dict
from galaxy.util.resources import resource_string
# Error codes are provided as a convience to Galaxy API clients,... | |
45,702 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/exceptions/utils.py | 4,5 | 1,34 | api_error_to_dict | 5,34 | 5,34 | from galaxy.exceptions import error_codes
def api_error_to_dict(**kwds):
FILL_FUNC_BODY | from galaxy.exceptions import error_codes
def api_error_to_dict(**kwds):
FILL_FUNC_BODY | UNKNOWN_ERROR_CODE = error_codes.error_codes_by_name["UNKNOWN"]
exception = kwds.get("exception", None)
if exception:
# If we are passed a MessageException use err_msg.
default_error_code = getattr(exception, "err_code", UNKNOWN_ERROR_CODE)
default_error_message = getattr(exception, ... | UNKNOWN_ERROR_CODE = error_codes.error_codes_by_name["UNKNOWN"]
exception = kwds.get("exception", None)
if exception:
# If we are passed a MessageException use err_msg.
default_error_code = getattr(exception, "err_code", UNKNOWN_ERROR_CODE)
default_error_message = getattr(exception, ... | 141 | 37 | 491 | 528 | from galaxy.exceptions import error_codes
def api_error_to_dict(**kwds):
FILL_FUNC_BODY | from galaxy.exceptions import error_codes
def api_error_to_dict(**kwds):
FILL_FUNC_BODY | |
45,703 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/plugins.py | 89,92 | 79,103 | load_plugins | FileSourcePluginLoader | 92,103 | 92,103 | class FileSourcePluginLoader:
def __init__(self):
self._plugin_classes = self._file_source_plugins_dict()
def _file_source_plugins_dict(self):
import galaxy.files.sources
return plugins_dict(galaxy.files.sources, "plugin_type")
def load_plugins(
self, plugin_source: Plugi... | class FileSourcePluginLoader:
def __init__(self):
self._plugin_classes = self._file_source_plugins_dict()
def _file_source_plugins_dict(self):
import galaxy.files.sources
return plugins_dict(galaxy.files.sources, "plugin_type")
def load_plugins(
self, plugin_source: Plugi... | extra_kwds = {
"file_sources_config": file_source_plugin_config,
}
return load_plugins(
self._plugin_classes,
plugin_source,
extra_kwds,
dict_to_list_key="id",
)
| extra_kwds = {
"file_sources_config": file_source_plugin_config,
}
return load_plugins(
self._plugin_classes,
plugin_source,
extra_kwds,
dict_to_list_key="id",
)
| 13 | 134 | 85 | 219 | from typing import (
List,
Optional,
TYPE_CHECKING,
)
from galaxy.util.config_parsers import parse_allowlist_ips
from galaxy.util.plugin_config import (
load_plugins,
PluginConfigSource,
plugins_dict,
)
if TYPE_CHECKING:
from galaxy.files.sources import BaseFilesSource
class FileSourcePl... | from typing import (
List,
Optional,
TYPE_CHECKING,
)
from galaxy.util.config_parsers import parse_allowlist_ips
from galaxy.util.plugin_config import (
load_plugins,
PluginConfigSource,
plugins_dict,
)
if TYPE_CHECKING:
from galaxy.files.sources import BaseFilesSource
class FileSourcePl... |
45,704 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/plugins.py | 44,46 | 18,79 | from_app_config | FileSourcePluginsConfig | 46,57 | 46,57 | class FileSourcePluginsConfig:
symlink_allowlist: List[str]
fetch_url_allowlist: List[str]
library_import_dir: Optional[str]
user_library_import_dir: Optional[str]
ftp_upload_dir: Optional[str]
ftp_upload_purge: bool
def __init__(
self,
symlink_allowlist=None,
fetch_... | class FileSourcePluginsConfig:
symlink_allowlist: List[str]
fetch_url_allowlist: List[str]
library_import_dir: Optional[str]
user_library_import_dir: Optional[str]
ftp_upload_dir: Optional[str]
ftp_upload_purge: bool
def __init__(
self,
symlink_allowlist=None,
fetch_... | # Formalize what we read in from config to create a more clear interface
# for this component.
kwds = {}
kwds["symlink_allowlist"] = config.user_library_import_symlink_allowlist
kwds["fetch_url_allowlist"] = [str(ip) for ip in config.fetch_url_allowlist_ips]
kwds["library... | # Formalize what we read in from config to create a more clear interface
# for this component.
kwds = {}
kwds["symlink_allowlist"] = config.user_library_import_symlink_allowlist
kwds["fetch_url_allowlist"] = [str(ip) for ip in config.fetch_url_allowlist_ips]
kwds["library... | 45 | 616 | 207 | 823 | from typing import (
List,
Optional,
TYPE_CHECKING,
)
from galaxy.util.config_parsers import parse_allowlist_ips
from galaxy.util.plugin_config import (
load_plugins,
PluginConfigSource,
plugins_dict,
)
if TYPE_CHECKING:
from galaxy.files.sources import BaseFilesSource
class FileSourcePl... | from typing import (
List,
Optional,
TYPE_CHECKING,
)
from galaxy.util.config_parsers import parse_allowlist_ips
from galaxy.util.plugin_config import (
load_plugins,
PluginConfigSource,
plugins_dict,
)
if TYPE_CHECKING:
from galaxy.files.sources import BaseFilesSource
class FileSourcePl... |
45,705 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/_pyfilesystem2.py | 86,93 | 34,122 | _write_from | PyFilesystem2FilesSource | 93,100 | 93,100 | class PyFilesystem2FilesSource(BaseFilesSource):
required_module: ClassVar[Optional[Type[FS]]]
required_package: ClassVar[str]
def __init__(self, **kwd: Unpack[FilesSourceProperties]):
if self.required_module is None:
raise Exception(PACKAGE_MESSAGE % self.required_package)
prop... | class PyFilesystem2FilesSource(BaseFilesSource):
required_module: ClassVar[Optional[Type[FS]]]
required_package: ClassVar[str]
def __init__(self, **kwd: Unpack[FilesSourceProperties]):
if self.required_module is None:
raise Exception(PACKAGE_MESSAGE % self.required_package)
prop... | with open(native_path, "rb") as read_file:
openfs = self._open_fs(user_context=user_context, opts=opts)
dirname = fs.path.dirname(target_path)
if not openfs.isdir(dirname):
openfs.makedirs(dirname)
openfs.upload(target_path, read_file)
| with open(native_path, "rb") as read_file:
openfs = self._open_fs(user_context=user_context, opts=opts)
dirname = fs.path.dirname(target_path)
if not openfs.isdir(dirname):
openfs.makedirs(dirname)
openfs.upload(target_path, read_file)
| 18 | 946 | 104 | 1,050 | import abc
import functools
import logging
import os
from typing import (
ClassVar,
List,
Optional,
Type,
)
import fs
import fs.errors
from fs.base import FS
from typing_extensions import Unpack
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
)
from galaxy.files impor... | import abc
import functools
import logging
import os
from typing import (
ClassVar,
List,
Optional,
Type,
)
import fs
import fs.errors
from fs.base import FS
from typing_extensions import Unpack
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
)
from galaxy.files impor... |
45,706 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/_rdm.py | 194,195 | 121,208 | get_authorization_token | RDMFilesSource | 195,205 | 195,205 | class RDMFilesSource(BaseFilesSource):
"""Base class for Research Data Management (RDM) file sources.
This class is not intended to be used directly, but rather to be subclassed
by file sources that interact with RDM repositories.
A RDM file source is similar to a regular file source, but instead of t... | class RDMFilesSource(BaseFilesSource):
"""Base class for Research Data Management (RDM) file sources.
This class is not intended to be used directly, but rather to be subclassed
by file sources that interact with RDM repositories.
A RDM file source is similar to a regular file source, but instead of t... | token = None
if user_context:
effective_props = self._serialization_props(user_context)
token = effective_props.get("token")
if not token:
raise AuthenticationRequired(
f"Please provide a personal access token in your user's preferences for '{s... | token = None
if user_context:
effective_props = self._serialization_props(user_context)
token = effective_props.get("token")
if not token:
raise AuthenticationRequired(
f"Please provide a personal access token in your user's preferences for '{s... | 31 | 1,013 | 96 | 1,109 | import logging
from typing import (
List,
NamedTuple,
Optional,
)
from typing_extensions import Unpack
from galaxy.exceptions import AuthenticationRequired
from galaxy.files import OptionalUserContext
from galaxy.files.sources import (
BaseFilesSource,
FilesSourceProperties,
PluginKind,
Re... | import logging
from typing import (
List,
NamedTuple,
Optional,
)
from typing_extensions import Unpack
from galaxy.exceptions import AuthenticationRequired
from galaxy.files import OptionalUserContext
from galaxy.files.sources import (
BaseFilesSource,
FilesSourceProperties,
PluginKind,
Re... |
45,707 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/_rdm.py | 81,84 | 34,121 | create_draft_record | RDMRepositoryInteractor | 88,90 | 84,90 | class RDMRepositoryInteractor:
"""Base class for interacting with an external RDM repository.
This class is not intended to be used directly, but rather to be subclassed
by file sources that interact with RDM repositories.
"""
def __init__(self, repository_url: str, plugin: "RDMFilesSource"):
... | class RDMRepositoryInteractor:
"""Base class for interacting with an external RDM repository.
This class is not intended to be used directly, but rather to be subclassed
by file sources that interact with RDM repositories.
"""
def __init__(self, repository_url: str, plugin: "RDMFilesSource"):
... | raise NotImplementedError()
| """Creates a draft record (directory) in the repository with basic metadata.
The metadata is usually just the title of the record and the user that created it.
Some plugins might also provide additional metadata defaults in the user settings."""
raise NotImplementedError()
| 2 | 861 | 12 | 873 | import logging
from typing import (
List,
NamedTuple,
Optional,
)
from typing_extensions import Unpack
from galaxy.exceptions import AuthenticationRequired
from galaxy.files import OptionalUserContext
from galaxy.files.sources import (
BaseFilesSource,
FilesSourceProperties,
PluginKind,
Re... | import logging
from typing import (
List,
NamedTuple,
Optional,
)
from typing_extensions import Unpack
from galaxy.exceptions import AuthenticationRequired
from galaxy.files import OptionalUserContext
from galaxy.files.sources import (
BaseFilesSource,
FilesSourceProperties,
PluginKind,
Re... |
45,708 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/anvil.py | 22,23 | 17,29 | _open_fs | AnVILFilesSource | 23,29 | 23,29 | class AnVILFilesSource(PyFilesystem2FilesSource):
plugin_type = "anvil"
required_module = AnVILFS
required_package = "fs.anvilfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | class AnVILFilesSource(PyFilesystem2FilesSource):
plugin_type = "anvil"
required_module = AnVILFS
required_package = "fs.anvilfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | props = self._serialization_props(user_context)
extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {}
handle = AnVILFS(**{**props, **extra_props})
return handle
| props = self._serialization_props(user_context)
extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {}
handle = AnVILFS(**{**props, **extra_props})
return handle
| 20 | 88 | 72 | 160 | try:
from anvilfs.anvilfs import AnVILFS
except ImportError:
AnVILFS = None
from typing import (
Optional,
Union,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFilesystem2FilesSource
class AnVILFilesSource(PyFilesystem2FilesSource):
plugin_ty... | try:
from anvilfs.anvilfs import AnVILFS
except ImportError:
AnVILFS = None
from typing import (
Optional,
Union,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFilesystem2FilesSource
class AnVILFilesSource(PyFilesystem2FilesSource):
plugin_ty... |
45,709 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/azure.py | 25,26 | 20,43 | _open_fs | AzureFileSource | 26,43 | 26,43 | class AzureFileSource(PyFilesystem2FilesSource):
plugin_type = "azure"
required_module = BlobFS
required_package = "fs-azureblob"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | class AzureFileSource(PyFilesystem2FilesSource):
plugin_type = "azure"
required_module = BlobFS
required_package = "fs-azureblob"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | props = self._serialization_props(user_context)
extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {}
all_props = {**props, **extra_props}
namespace_type = all_props.get("namespace_type", "hierarchical")
if namespace_type not in ["hierarchical",... | props = self._serialization_props(user_context)
extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {}
all_props = {**props, **extra_props}
namespace_type = all_props.get("namespace_type", "hierarchical")
if namespace_type not in ["hierarchical",... | 59 | 83 | 224 | 307 | from typing import Union
try:
from fs.azblob import (
BlobFS,
BlobFSV2,
)
except ImportError:
BlobFS = None
from typing import Optional
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFilesystem2FilesSource
class AzureFileSource(PyFiles... | from typing import Union
try:
from fs.azblob import (
BlobFS,
BlobFSV2,
)
except ImportError:
BlobFS = None
from typing import Optional
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFilesystem2FilesSource
class AzureFileSource(PyFiles... |
45,710 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/base64.py | 59,60 | 18,66 | _serialization_props | Base64FilesSource | 60,66 | 60,66 | class Base64FilesSource(BaseFilesSource):
plugin_type = "base64"
plugin_kind = PluginKind.stock
def __init__(self, **kwd: Unpack[FilesSourceProperties]):
kwds: FilesSourceProperties = dict(
id="_base64",
label="Base64 encoded string",
doc="Base64 string handler",... | class Base64FilesSource(BaseFilesSource):
plugin_type = "base64"
plugin_kind = PluginKind.stock
def __init__(self, **kwd: Unpack[FilesSourceProperties]):
kwds: FilesSourceProperties = dict(
id="_base64",
label="Base64 encoded string",
doc="Base64 string handler",... | effective_props = {}
for key, val in self._props.items():
effective_props[key] = self._evaluate_prop(val, user_context=user_context)
return effective_props
| effective_props = {}
for key, val in self._props.items():
effective_props[key] = self._evaluate_prop(val, user_context=user_context)
return effective_props
| 14 | 401 | 60 | 461 | import base64
import logging
from typing import Optional
from typing_extensions import Unpack
from galaxy.files import OptionalUserContext
from . import (
BaseFilesSource,
FilesSourceOptions,
FilesSourceProperties,
PluginKind,
)
log = logging.getLogger(__name__)
class Base64FilesSource(BaseFilesSou... | import base64
import logging
from typing import Optional
from typing_extensions import Unpack
from galaxy.files import OptionalUserContext
from . import (
BaseFilesSource,
FilesSourceOptions,
FilesSourceProperties,
PluginKind,
)
log = logging.getLogger(__name__)
class Base64FilesSource(BaseFilesSou... |
45,711 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/basespace.py | 23,24 | 18,30 | _open_fs | BaseSpaceFilesSource | 24,30 | 24,30 | class BaseSpaceFilesSource(PyFilesystem2FilesSource):
plugin_type = "basespace"
required_module = BASESPACEFS
required_package = "fs-basespace"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | class BaseSpaceFilesSource(PyFilesystem2FilesSource):
plugin_type = "basespace"
required_module = BASESPACEFS
required_package = "fs-basespace"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | props = self._serialization_props(user_context)
extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {}
handle = BASESPACEFS(**{**props, **extra_props})
return handle
| props = self._serialization_props(user_context)
extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {}
handle = BASESPACEFS(**{**props, **extra_props})
return handle
| 20 | 87 | 73 | 160 | try:
from fs_basespace import BASESPACEFS
except ImportError:
BASESPACEFS = None
from typing import (
Optional,
Union,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFilesystem2FilesSource
class BaseSpaceFilesSource(PyFilesystem2FilesSource):
... | try:
from fs_basespace import BASESPACEFS
except ImportError:
BASESPACEFS = None
from typing import (
Optional,
Union,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFilesystem2FilesSource
class BaseSpaceFilesSource(PyFilesystem2FilesSource):
... |
45,712 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/dropbox.py | 27,28 | 22,47 | _open_fs | DropboxFilesSource | 28,47 | 28,47 | class DropboxFilesSource(PyFilesystem2FilesSource):
plugin_type = "dropbox"
required_module = DropboxFS
required_package = "fs.dropboxfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | class DropboxFilesSource(PyFilesystem2FilesSource):
plugin_type = "dropbox"
required_module = DropboxFS
required_package = "fs.dropboxfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | props = self._serialization_props(user_context)
extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {}
# accessToken has been renamed to access_token in fs.dropboxfs 1.0
if "accessToken" in props:
props["access_token"] = props.pop("accessToke... | props = self._serialization_props(user_context)
extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {}
# accessToken has been renamed to access_token in fs.dropboxfs 1.0
if "accessToken" in props:
props["access_token"] = props.pop("accessToke... | 83 | 84 | 252 | 336 | try:
from fs.dropboxfs import DropboxFS
except ImportError:
DropboxFS = None
from typing import (
Optional,
Union,
)
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFi... | try:
from fs.dropboxfs import DropboxFS
except ImportError:
DropboxFS = None
from typing import (
Optional,
Union,
)
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFi... |
45,713 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/ftp.py | 100,101 | 30,114 | score_url_match | FtpFilesSource | 101,114 | 101,114 | class FtpFilesSource(PyFilesystem2FilesSource):
plugin_type = "ftp"
required_module = FTPFS
required_package = "fs.ftpfs"
def _open_fs(self, user_context: OptionalUserContext = None, opts: Optional[FilesSourceOptions] = None):
props = self._serialization_props(user_context)
extra_props:... | class FtpFilesSource(PyFilesystem2FilesSource):
plugin_type = "ftp"
required_module = FTPFS
required_package = "fs.ftpfs"
def _open_fs(self, user_context: OptionalUserContext = None, opts: Optional[FilesSourceOptions] = None):
props = self._serialization_props(user_context)
extra_props:... | host = self._props.get("host")
port = self._props.get("port")
if host and port and url.startswith(f"ftp://{host}:{port}"):
return len(f"ftp://{host}:{port}")
# For security, we need to ensure that a partial match doesn't work e.g. ftp://{host}something/myfiles
elif ho... | host = self._props.get("host")
port = self._props.get("port")
if host and port and url.startswith(f"ftp://{host}:{port}"):
return len(f"ftp://{host}:{port}")
# For security, we need to ensure that a partial match doesn't work e.g. ftp://{host}something/myfiles
elif ho... | 49 | 844 | 203 | 1,047 | import urllib.parse
from galaxy.files import OptionalUserContext
try:
from fs.ftpfs import FTPFS
except ImportError:
FTPFS = None # type: ignore[misc,assignment]
from typing import (
cast,
Optional,
Tuple,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesyste... | import urllib.parse
from galaxy.files import OptionalUserContext
try:
from fs.ftpfs import FTPFS
except ImportError:
FTPFS = None # type: ignore[misc,assignment]
from typing import (
cast,
Optional,
Tuple,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesyste... |
45,714 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/galaxy.py | 59,60 | 42,63 | get_scheme | LibraryImportFilesSource | 60,63 | 60,63 | class LibraryImportFilesSource(PosixFilesSource):
plugin_type = "gximport"
plugin_kind = PluginKind.stock
def __init__(self, **kwd: Unpack[PosixFilesSourceProperties]):
posix_kwds: PosixFilesSourceProperties = dict(
id="_import",
root="${config.library_import_dir}",
... | class LibraryImportFilesSource(PosixFilesSource):
plugin_type = "gximport"
plugin_kind = PluginKind.stock
def __init__(self, **kwd: Unpack[PosixFilesSourceProperties]):
posix_kwds: PosixFilesSourceProperties = dict(
id="_import",
root="${config.library_import_dir}",
... | return "gximport"
| return "gximport"
| 2 | 192 | 13 | 205 | """Static Galaxy file sources - ftp and libraries."""
from typing import (
cast,
Optional,
)
from typing_extensions import Unpack
from galaxy.files.sources import PluginKind
from .posix import (
PosixFilesSource,
PosixFilesSourceProperties,
)
class UserFtpFilesSource(PosixFilesSource):
plugin_t... | """Static Galaxy file sources - ftp and libraries."""
from typing import (
cast,
Optional,
)
from typing_extensions import Unpack
from galaxy.files.sources import PluginKind
from .posix import (
PosixFilesSource,
PosixFilesSourceProperties,
)
class UserFtpFilesSource(PosixFilesSource):
plugin_t... |
45,715 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/galaxy.py | 35,36 | 17,42 | get_prefix | UserFtpFilesSource | 36,38 | 36,38 | class UserFtpFilesSource(PosixFilesSource):
plugin_type = "gxftp"
plugin_kind = PluginKind.stock
def __init__(self, **kwd: Unpack[PosixFilesSourceProperties]):
posix_kwds: PosixFilesSourceProperties = dict(
id="_ftp",
root="${user.ftp_dir}",
label="FTP Directory"... | class UserFtpFilesSource(PosixFilesSource):
plugin_type = "gxftp"
plugin_kind = PluginKind.stock
def __init__(self, **kwd: Unpack[PosixFilesSourceProperties]):
posix_kwds: PosixFilesSourceProperties = dict(
id="_ftp",
root="${user.ftp_dir}",
label="FTP Directory"... | return None
| return None
| 2 | 278 | 7 | 285 | """Static Galaxy file sources - ftp and libraries."""
from typing import (
cast,
Optional,
)
from typing_extensions import Unpack
from galaxy.files.sources import PluginKind
from .posix import (
PosixFilesSource,
PosixFilesSourceProperties,
)
class UserFtpFilesSource(PosixFilesSource):
plugin_t... | """Static Galaxy file sources - ftp and libraries."""
from typing import (
cast,
Optional,
)
from typing_extensions import Unpack
from galaxy.files.sources import PluginKind
from .posix import (
PosixFilesSource,
PosixFilesSourceProperties,
)
class UserFtpFilesSource(PosixFilesSource):
plugin_t... |
45,716 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/galaxy.py | 80,81 | 63,84 | get_scheme | UserLibraryImportFilesSource | 81,84 | 81,84 | class UserLibraryImportFilesSource(PosixFilesSource):
plugin_type = "gxuserimport"
plugin_kind = PluginKind.stock
def __init__(self, **kwd: Unpack[PosixFilesSourceProperties]):
posix_kwds: PosixFilesSourceProperties = dict(
id="_userimport",
root="${config.user_library_impor... | class UserLibraryImportFilesSource(PosixFilesSource):
plugin_type = "gxuserimport"
plugin_kind = PluginKind.stock
def __init__(self, **kwd: Unpack[PosixFilesSourceProperties]):
posix_kwds: PosixFilesSourceProperties = dict(
id="_userimport",
root="${config.user_library_impor... | return "gxuserimport"
| return "gxuserimport"
| 2 | 205 | 14 | 219 | """Static Galaxy file sources - ftp and libraries."""
from typing import (
cast,
Optional,
)
from typing_extensions import Unpack
from galaxy.files.sources import PluginKind
from .posix import (
PosixFilesSource,
PosixFilesSourceProperties,
)
class UserFtpFilesSource(PosixFilesSource):
plugin_t... | """Static Galaxy file sources - ftp and libraries."""
from typing import (
cast,
Optional,
)
from typing_extensions import Unpack
from galaxy.files.sources import PluginKind
from .posix import (
PosixFilesSource,
PosixFilesSourceProperties,
)
class UserFtpFilesSource(PosixFilesSource):
plugin_t... |
45,717 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/googlecloudstorage.py | 32,33 | 27,49 | _open_fs | GoogleCloudStorageFilesSource | 33,49 | 33,49 | class GoogleCloudStorageFilesSource(PyFilesystem2FilesSource):
plugin_type = "googlecloudstorage"
required_module = GCSFS
required_package = "fs-gcsfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | class GoogleCloudStorageFilesSource(PyFilesystem2FilesSource):
plugin_type = "googlecloudstorage"
required_module = GCSFS
required_package = "fs-gcsfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | props = self._serialization_props(user_context)
extra_props: GoogleCloudStorageFilesSourceProperties = cast(
GoogleCloudStorageFilesSourceProperties, opts.extra_props or {} if opts else {}
)
bucket_name = props.pop("bucket_name", None)
root_path = props.pop("root_path... | props = self._serialization_props(user_context)
extra_props: GoogleCloudStorageFilesSourceProperties = cast(
GoogleCloudStorageFilesSourceProperties, opts.extra_props or {} if opts else {}
)
bucket_name = props.pop("bucket_name", None)
root_path = props.pop("root_path... | 51 | 87 | 219 | 306 | try:
from fs_gcsfs import GCSFS
from google.cloud.storage import Client
from google.oauth2.credentials import Credentials
except ImportError:
GCSFS = None
from typing import (
cast,
Optional,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyF... | try:
from fs_gcsfs import GCSFS
from google.cloud.storage import Client
from google.oauth2.credentials import Credentials
except ImportError:
GCSFS = None
from typing import (
cast,
Optional,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyF... |
45,718 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/googledrive.py | 18,19 | 13,25 | _open_fs | GoogleDriveFilesSource | 19,25 | 19,25 | class GoogleDriveFilesSource(PyFilesystem2FilesSource):
plugin_type = "googledrive"
required_module = GoogleDriveFS
required_package = "fs.googledrivefs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | class GoogleDriveFilesSource(PyFilesystem2FilesSource):
plugin_type = "googledrive"
required_module = GoogleDriveFS
required_package = "fs.googledrivefs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | props = self._serialization_props(user_context)
credentials = Credentials(**props)
handle = GoogleDriveFS(credentials)
return handle
| props = self._serialization_props(user_context)
credentials = Credentials(**props)
handle = GoogleDriveFS(credentials)
return handle
| 11 | 88 | 50 | 138 | try:
from fs.googledrivefs import GoogleDriveFS
from google.oauth2.credentials import Credentials
except ImportError:
GoogleDriveFS = None
from typing import Optional
from . import FilesSourceOptions
from ._pyfilesystem2 import PyFilesystem2FilesSource
class GoogleDriveFilesSource(PyFilesystem2FilesSour... | try:
from fs.googledrivefs import GoogleDriveFS
from google.oauth2.credentials import Credentials
except ImportError:
GoogleDriveFS = None
from typing import Optional
from . import FilesSourceOptions
from ._pyfilesystem2 import PyFilesystem2FilesSource
class GoogleDriveFilesSource(PyFilesystem2FilesSour... |
45,719 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/onedata.py | 12,13 | 1,33 | remove_prefix | 13,18 | 13,18 | try:
from fs.onedatarestfs import OnedataRESTFS
except ImportError:
OnedataRESTFS = None
from typing import Optional
from . import FilesSourceOptions
from ._pyfilesystem2 import PyFilesystem2FilesSource
def remove_prefix(prefix, string):
FILL_FUNC_BODYclass OnedataFilesSource(PyFilesystem2FilesSource):
... | try:
from fs.onedatarestfs import OnedataRESTFS
except ImportError:
OnedataRESTFS = None
from typing import Optional
from . import FilesSourceOptions
from ._pyfilesystem2 import PyFilesystem2FilesSource
def remove_prefix(prefix, string):
FILL_FUNC_BODYclass OnedataFilesSource(PyFilesystem2FilesSource):
... | if string.startswith(prefix):
string = string[len(prefix) :]
return string
| if string.startswith(prefix):
string = string[len(prefix) :]
return string
| 8 | 280 | 34 | 314 | try:
from fs.onedatarestfs import OnedataRESTFS
except ImportError:
OnedataRESTFS = None
from typing import Optional
from . import FilesSourceOptions
from ._pyfilesystem2 import PyFilesystem2FilesSource
def remove_prefix(prefix, string):
FILL_FUNC_BODYclass OnedataFilesSource(PyFilesystem2FilesSource):
... | try:
from fs.onedatarestfs import OnedataRESTFS
except ImportError:
OnedataRESTFS = None
from typing import Optional
from . import FilesSourceOptions
from ._pyfilesystem2 import PyFilesystem2FilesSource
def remove_prefix(prefix, string):
FILL_FUNC_BODYclass OnedataFilesSource(PyFilesystem2FilesSource):
... | |
45,720 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/onedata.py | 23,24 | 18,32 | _open_fs | OnedataFilesSource | 24,32 | 24,32 | class OnedataFilesSource(PyFilesystem2FilesSource):
plugin_type = "onedata"
required_module = OnedataRESTFS
required_package = "fs.onedatarestfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | class OnedataFilesSource(PyFilesystem2FilesSource):
plugin_type = "onedata"
required_module = OnedataRESTFS
required_package = "fs.onedatarestfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | props = self._serialization_props(user_context)
onezone_domain = props.pop("onezoneDomain", "") or ""
onezone_domain = remove_prefix("http://", remove_prefix("https://", onezone_domain))
access_token = props.pop("accessToken", "") or ""
handle = OnedataRESTFS(onezone_domain, acce... | props = self._serialization_props(user_context)
onezone_domain = props.pop("onezoneDomain", "") or ""
onezone_domain = remove_prefix("http://", remove_prefix("https://", onezone_domain))
access_token = props.pop("accessToken", "") or ""
handle = OnedataRESTFS(onezone_domain, acce... | 26 | 89 | 111 | 200 | try:
from fs.onedatarestfs import OnedataRESTFS
except ImportError:
OnedataRESTFS = None
from typing import Optional
from . import FilesSourceOptions
from ._pyfilesystem2 import PyFilesystem2FilesSource
def remove_prefix(prefix, string):
if string.startswith(prefix):
string = string[len(prefix) ... | try:
from fs.onedatarestfs import OnedataRESTFS
except ImportError:
OnedataRESTFS = None
from typing import Optional
from . import FilesSourceOptions
from ._pyfilesystem2 import PyFilesystem2FilesSource
def remove_prefix(prefix, string):
if string.startswith(prefix):
string = string[len(prefix) ... |
45,722 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/s3fs.py | 58,65 | 40,154 | _list | S3FsFilesSource | 65,83 | 65,83 | class S3FsFilesSource(BaseFilesSource):
plugin_type = "s3fs"
def __init__(self, **kwd: Unpack[S3FsFilesSourceProperties]):
if s3fs is None:
raise Exception("Package s3fs unavailable but required for this file source plugin.")
props: S3FsFilesSourceProperties = cast(S3FsFilesSourcePr... | class S3FsFilesSource(BaseFilesSource):
plugin_type = "s3fs"
def __init__(self, **kwd: Unpack[S3FsFilesSourceProperties]):
if s3fs is None:
raise Exception("Package s3fs unavailable but required for this file source plugin.")
props: S3FsFilesSourceProperties = cast(S3FsFilesSourcePr... | _props = self._serialization_props(user_context)
# we need to pop the 'bucket' here, because the argument is not recognised in a downstream function
_bucket_name = _props.pop("bucket", "")
fs = self._open_fs(props=_props, opts=opts)
if recursive:
res: List[AnyRemoteEn... | _props = self._serialization_props(user_context)
# we need to pop the 'bucket' here, because the argument is not recognised in a downstream function
_bucket_name = _props.pop("bucket", "")
fs = self._open_fs(props=_props, opts=opts)
if recursive:
res: List[AnyRemoteEn... | 72 | 1,270 | 297 | 1,567 | import functools
import logging
import os
from typing import (
cast,
List,
Optional,
)
from typing_extensions import Unpack
from galaxy.files import OptionalUserContext
from . import (
AnyRemoteEntry,
FilesSourceOptions,
FilesSourceProperties,
)
try:
import s3fs
except ImportError:
s3... | import functools
import logging
import os
from typing import (
cast,
List,
Optional,
)
from typing_extensions import Unpack
from galaxy.files import OptionalUserContext
from . import (
AnyRemoteEntry,
FilesSourceOptions,
FilesSourceProperties,
)
try:
import s3fs
except ImportError:
s3... |
45,723 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/ssh.py | 23,24 | 18,33 | _open_fs | SshFilesSource | 24,33 | 24,33 | class SshFilesSource(PyFilesystem2FilesSource):
plugin_type = "ssh"
required_module = SSHFS
required_package = "fs.sshfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | class SshFilesSource(PyFilesystem2FilesSource):
plugin_type = "ssh"
required_module = SSHFS
required_package = "fs.sshfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | props = self._serialization_props(user_context)
extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {}
path = props.pop("path")
handle = SSHFS(**{**props, **extra_props})
if path:
handle = handle.opendir(path)
return handle
| props = self._serialization_props(user_context)
extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {}
path = props.pop("path")
handle = SSHFS(**{**props, **extra_props})
if path:
handle = handle.opendir(path)
return handle
| 28 | 81 | 100 | 181 | try:
from fs.sshfs import SSHFS
except ImportError:
SSHFS = None
from typing import (
Optional,
Union,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFilesystem2FilesSource
class SshFilesSource(PyFilesystem2FilesSource):
plugin_type = "ssh"
... | try:
from fs.sshfs import SSHFS
except ImportError:
SSHFS = None
from typing import (
Optional,
Union,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFilesystem2FilesSource
class SshFilesSource(PyFilesystem2FilesSource):
plugin_type = "ssh"
... |
45,724 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/util.py | 79,88 | 1,141 | fetch_drs_to_file | 89,141 | 88,141 | import time
from os import PathLike
from typing import (
List,
Optional,
Tuple,
Union,
)
import requests
from galaxy import exceptions
from galaxy.files import (
ConfiguredFileSources,
FileSourcesUserContext,
)
from galaxy.files.sources import FilesSourceOptions
from galaxy.files.sources.http ... | import time
from os import PathLike
from typing import (
List,
Optional,
Tuple,
Union,
)
import requests
from galaxy import exceptions
from galaxy.files import (
ConfiguredFileSources,
FileSourcesUserContext,
)
from galaxy.files.sources import FilesSourceOptions
from galaxy.files.sources.http ... | if not drs_uri.startswith("drs://"):
raise ValueError(f"Unknown scheme for drs_uri {drs_uri}")
rest_of_drs_uri = drs_uri[len("drs://") :]
if "/" not in rest_of_drs_uri:
# DRS URI uses compact identifiers, not yet implemented.
# https://ga4gh.github.io/data-repository-service-schemas/... | """Fetch contents of drs:// URI to a target path."""
if not drs_uri.startswith("drs://"):
raise ValueError(f"Unknown scheme for drs_uri {drs_uri}")
rest_of_drs_uri = drs_uri[len("drs://") :]
if "/" not in rest_of_drs_uri:
# DRS URI uses compact identifiers, not yet implemented.
#... | 164 | 1,004 | 739 | 1,743 | import time
from os import PathLike
from typing import (
List,
Optional,
Tuple,
Union,
)
import requests
from galaxy import exceptions
from galaxy.files import (
ConfiguredFileSources,
FileSourcesUserContext,
)
from galaxy.files.sources import FilesSourceOptions
from galaxy.files.sources.http ... | import time
from os import PathLike
from typing import (
List,
Optional,
Tuple,
Union,
)
import requests
from galaxy import exceptions
from galaxy.files import (
ConfiguredFileSources,
FileSourcesUserContext,
)
from galaxy.files.sources import FilesSourceOptions
from galaxy.files.sources.http ... | |
45,725 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/webdav.py | 24,25 | 19,36 | _open_fs | WebDavFilesSource | 25,36 | 25,36 | class WebDavFilesSource(PyFilesystem2FilesSource):
plugin_type = "webdav"
required_module = WebDAVFS
required_package = "fs.webdavfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | class WebDavFilesSource(PyFilesystem2FilesSource):
plugin_type = "webdav"
required_module = WebDAVFS
required_package = "fs.webdavfs"
def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None):
FILL_FUNC_BODY | props = self._serialization_props(user_context)
use_temp_files = props.pop("use_temp_files", None)
if use_temp_files is None:
# Default to True to avoid memory issues with large files.
props["use_temp_files"] = True
props["temp_path"] = props.get("temp_path", ... | props = self._serialization_props(user_context)
use_temp_files = props.pop("use_temp_files", None)
if use_temp_files is None:
# Default to True to avoid memory issues with large files.
props["use_temp_files"] = True
props["temp_path"] = props.get("temp_path", ... | 46 | 88 | 166 | 254 | try:
from webdavfs.webdavfs import WebDAVFS
except ImportError:
WebDAVFS = None
import tempfile
from typing import (
Optional,
Union,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFilesystem2FilesSource
class WebDavFilesSource(PyFilesystem2Files... | try:
from webdavfs.webdavfs import WebDAVFS
except ImportError:
WebDAVFS = None
import tempfile
from typing import (
Optional,
Union,
)
from . import (
FilesSourceOptions,
FilesSourceProperties,
)
from ._pyfilesystem2 import PyFilesystem2FilesSource
class WebDavFilesSource(PyFilesystem2Files... |
45,726 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/files/sources/zenodo.py | 17,18 | 4,21 | get_scheme | ZenodoRDMFilesSource | 18,21 | 18,21 | class ZenodoRDMFilesSource(InvenioRDMFilesSource):
"""A files source for Zenodo repositories.
Zenodo is an open science platform developed by CERN. It allows researchers
to deposit data, software, and other research outputs for long-term
preservation and sharing.
Zenodo repositories are based on I... | class ZenodoRDMFilesSource(InvenioRDMFilesSource):
"""A files source for Zenodo repositories.
Zenodo is an open science platform developed by CERN. It allows researchers
to deposit data, software, and other research outputs for long-term
preservation and sharing.
Zenodo repositories are based on I... | return "zenodo"
| return "zenodo"
| 2 | 152 | 12 | 164 | from galaxy.files.sources.invenio import InvenioRDMFilesSource
class ZenodoRDMFilesSource(InvenioRDMFilesSource):
"""A files source for Zenodo repositories.
Zenodo is an open science platform developed by CERN. It allows researchers
to deposit data, software, and other research outputs for long-term
... | from galaxy.files.sources.invenio import InvenioRDMFilesSource
class ZenodoRDMFilesSource(InvenioRDMFilesSource):
"""A files source for Zenodo repositories.
Zenodo is an open science platform developed by CERN. It allows researchers
to deposit data, software, and other research outputs for long-term
... |
45,728 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_execution/container_monitor.py | 38,39 | 1,95 | main | 39,93 | 39,93 | import json
import os
import shlex
import subprocess
import sys
import tempfile
import time
import traceback
from functools import partial
from typing import Callable
import requests
from galaxy.tool_util.deps import docker_util
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from galaxy.util.sockets import get_ip
Ge... | import json
import os
import shlex
import subprocess
import sys
import tempfile
import time
import traceback
from functools import partial
from typing import Callable
import requests
from galaxy.tool_util.deps import docker_util
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from galaxy.util.sockets import get_ip
Ge... | if not os.path.exists("configs"):
# on Pulsar and in tool working directory instead of job directory
os.chdir("..")
with open("configs/container_config.json") as f:
container_config = json.load(f)
container_type = container_config["container_type"]
container_name = container_co... | if not os.path.exists("configs"):
# on Pulsar and in tool working directory instead of job directory
os.chdir("..")
with open("configs/container_config.json") as f:
container_config = json.load(f)
container_type = container_config["container_type"]
container_name = container_co... | 167 | 339 | 663 | 1,002 | import json
import os
import shlex
import subprocess
import sys
import tempfile
import time
import traceback
from functools import partial
from typing import Callable
import requests
from galaxy.tool_util.deps import docker_util
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from galaxy.util.sockets import get_ip
Ge... | import json
import os
import shlex
import subprocess
import sys
import tempfile
import time
import traceback
from functools import partial
from typing import Callable
import requests
from galaxy.tool_util.deps import docker_util
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from galaxy.util.sockets import get_ip
Ge... | |
45,729 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_execution/datasets.py | 12,13 | 1,132 | dataset_path_rewrites | 13,17 | 13,17 | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
FILL_FUNC_BODYclass DatasetPath:
def __init__(
self,
dataset_id,
real_path,
false_path=None,
... | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
FILL_FUNC_BODYclass DatasetPath:
def __init__(
self,
dataset_id,
real_path,
false_path=None,
... | dataset_paths_with_rewrites = [path for path in dataset_paths if getattr(path, "false_path", None)]
return {dp.real_path: dp for dp in dataset_paths_with_rewrites}
| dataset_paths_with_rewrites = [path for path in dataset_paths if getattr(path, "false_path", None)]
return {dp.real_path: dp for dp in dataset_paths_with_rewrites}
| 18 | 1,275 | 63 | 1,338 | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
FILL_FUNC_BODYclass DatasetPath:
def __init__(
self,
dataset_id,
real_path,
false_path=None,
... | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
FILL_FUNC_BODYclass DatasetPath:
def __init__(
self,
dataset_id,
real_path,
false_path=None,
... | |
45,730 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_execution/datasets.py | 44,45 | 17,61 | with_path_for_job | DatasetPath | 48,61 | 45,61 | class DatasetPath:
def __init__(
self,
dataset_id,
real_path,
false_path=None,
false_extra_files_path=None,
false_metadata_path=None,
mutable=True,
dataset_uuid=None,
object_store_id=None,
):
self.dataset_id = dataset_id
sel... | class DatasetPath:
def __init__(
self,
dataset_id,
real_path,
false_path=None,
false_extra_files_path=None,
false_metadata_path=None,
mutable=True,
dataset_uuid=None,
object_store_id=None,
):
self.dataset_id = dataset_id
sel... | dataset_path = self
if false_path is not None:
dataset_path = DatasetPath(
dataset_id=self.dataset_id,
real_path=self.real_path,
false_path=false_path,
false_extra_files_path=false_extra_files_path,
false_metadat... | """
Clone the dataset path but with a new false_path.
"""
dataset_path = self
if false_path is not None:
dataset_path = DatasetPath(
dataset_id=self.dataset_id,
real_path=self.real_path,
false_path=false_path,
... | 20 | 295 | 126 | 421 | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
dataset_paths_with_rewrites = [path for path in dataset_paths if getattr(path, "false_path", None)]
return {dp.real_path: dp f... | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
dataset_paths_with_rewrites = [path for path in dataset_paths if getattr(path, "false_path", None)]
return {dp.real_path: dp f... |
45,731 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_execution/datasets.py | 75,76 | 72,80 | rewrite_dataset_path | NullDatasetPathRewriter | 77,80 | 76,80 | class NullDatasetPathRewriter(DatasetPathRewriter):
"""Used by default for jobwrapper, do not rewrite anything."""
def rewrite_dataset_path(self, dataset, dataset_type):
FILL_FUNC_BODY | class NullDatasetPathRewriter(DatasetPathRewriter):
"""Used by default for jobwrapper, do not rewrite anything."""
def rewrite_dataset_path(self, dataset, dataset_type):
"""Keep path the same."""
FILL_FUNC_BODY | return None
| """Keep path the same."""
return None
| 2 | 68 | 9 | 77 | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
dataset_paths_with_rewrites = [path for path in dataset_paths if getattr(path, "false_path", None)]
return {dp.real_path: dp f... | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
dataset_paths_with_rewrites = [path for path in dataset_paths if getattr(path, "false_path", None)]
return {dp.real_path: dp f... |
45,732 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_execution/datasets.py | 91,92 | 80,104 | rewrite_dataset_path | OutputsToWorkingDirectoryPathRewriter | 93,104 | 92,104 | class OutputsToWorkingDirectoryPathRewriter(DatasetPathRewriter):
"""Rewrites all paths to place them in the specified working
directory for normal jobs when Galaxy is configured with
app.config.outputs_to_working_directory. Job runner base class
is responsible for copying these out after job is complet... | class OutputsToWorkingDirectoryPathRewriter(DatasetPathRewriter):
"""Rewrites all paths to place them in the specified working
directory for normal jobs when Galaxy is configured with
app.config.outputs_to_working_directory. Job runner base class
is responsible for copying these out after job is complet... | if dataset_type == "output":
base_output_directory = os.path.abspath(self.working_directory)
if self.outputs_directory_name is not None:
base_output_directory = os.path.join(base_output_directory, self.outputs_directory_name)
# set false_path to uuid, no harm ... | """Keep path the same."""
if dataset_type == "output":
base_output_directory = os.path.abspath(self.working_directory)
if self.outputs_directory_name is not None:
base_output_directory = os.path.join(base_output_directory, self.outputs_directory_name)
... | 38 | 163 | 152 | 315 | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
dataset_paths_with_rewrites = [path for path in dataset_paths if getattr(path, "false_path", None)]
return {dp.real_path: dp f... | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
dataset_paths_with_rewrites = [path for path in dataset_paths if getattr(path, "false_path", None)]
return {dp.real_path: dp f... |
45,733 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_execution/datasets.py | 114,115 | 104,121 | rewrite_dataset_path | TaskPathRewriter | 116,121 | 115,121 | class TaskPathRewriter(DatasetPathRewriter):
"""Rewrites all paths to place them in the specified working
directory for TaskWrapper. TaskWrapper is responsible for putting
them there and pulling them out.
"""
def __init__(self, working_directory, job_dataset_path_rewriter):
self.working_dir... | class TaskPathRewriter(DatasetPathRewriter):
"""Rewrites all paths to place them in the specified working
directory for TaskWrapper. TaskWrapper is responsible for putting
them there and pulling them out.
"""
def __init__(self, working_directory, job_dataset_path_rewriter):
self.working_dir... | dataset_file_name = dataset.get_file_name()
job_file_name = self.job_dataset_path_rewriter.rewrite_dataset_path(dataset, dataset_type) or dataset_file_name
return os.path.join(self.working_directory, os.path.basename(job_file_name))
| """ """
dataset_file_name = dataset.get_file_name()
job_file_name = self.job_dataset_path_rewriter.rewrite_dataset_path(dataset, dataset_type) or dataset_file_name
return os.path.join(self.working_directory, os.path.basename(job_file_name))
| 12 | 141 | 89 | 230 | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
dataset_paths_with_rewrites = [path for path in dataset_paths if getattr(path, "false_path", None)]
return {dp.real_path: dp f... | """
Utility classes allowing Job interface to reason about datasets.
"""
import os.path
from abc import (
ABCMeta,
abstractmethod,
)
def dataset_path_rewrites(dataset_paths):
dataset_paths_with_rewrites = [path for path in dataset_paths if getattr(path, "false_path", None)]
return {dp.real_path: dp f... |
45,736 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_execution/setup.py | 56,58 | 50,65 | populated | JobOutputs | 58,60 | 58,60 | class JobOutputs(threading.local):
def __init__(self) -> None:
super().__init__()
self.output_hdas_and_paths: Optional[OutputHdasAndType] = None
self.output_paths: Optional[OutputPaths] = None
@property
def populated(self) -> bool:
FILL_FUNC_BODY def set_job_outputs(self, job_out... | class JobOutputs(threading.local):
def __init__(self) -> None:
super().__init__()
self.output_hdas_and_paths: Optional[OutputHdasAndType] = None
self.output_paths: Optional[OutputPaths] = None
@property
def populated(self) -> bool:
FILL_FUNC_BODY def set_job_outputs(self, job_out... | return self.output_hdas_and_paths is not None
| return self.output_hdas_and_paths is not None
| 5 | 186 | 19 | 205 | """Utilities to help job and tool code setup jobs."""
import json
import os
import threading
from typing import (
Any,
cast,
Dict,
List,
NamedTuple,
Optional,
Tuple,
Union,
)
from galaxy.files import (
ConfiguredFileSources,
DictFileSourcesUserContext,
FileSourcesUserContex... | """Utilities to help job and tool code setup jobs."""
import json
import os
import threading
from typing import (
Any,
cast,
Dict,
List,
NamedTuple,
Optional,
Tuple,
Union,
)
from galaxy.files import (
ConfiguredFileSources,
DictFileSourcesUserContext,
FileSourcesUserContex... |
45,737 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/formatting.py | 21,22 | 1,32 | seconds_to_str | 23,32 | 22,32 | """Utilities related to formatting job metrics for human consumption."""
from typing import (
Any,
NamedTuple,
)
class FormattedMetric(NamedTuple):
title: str
value: str
class JobMetricFormatter:
"""Format job metric key-value pairs for human consumption in Web UI."""
def format(self, key:... | """Utilities related to formatting job metrics for human consumption."""
from typing import (
Any,
NamedTuple,
)
class FormattedMetric(NamedTuple):
title: str
value: str
class JobMetricFormatter:
"""Format job metric key-value pairs for human consumption in Web UI."""
def format(self, key:... | mins, secs = divmod(value, 60)
hours, mins = divmod(mins, 60)
if value < 60:
return f"{secs} second{'s' if secs != 1 else ''}"
elif value < 3600:
return f"{mins} minute{'s' if mins != 1 else ''}"
else:
return f"{hours} hour{'s' if hours != 1 else ''} and {mins} minute{'s' if... | """Convert seconds to a simple simple string describing the amount of time."""
mins, secs = divmod(value, 60)
hours, mins = divmod(mins, 60)
if value < 60:
return f"{secs} second{'s' if secs != 1 else ''}"
elif value < 3600:
return f"{mins} minute{'s' if mins != 1 else ''}"
else... | 55 | 164 | 151 | 315 | """Utilities related to formatting job metrics for human consumption."""
from typing import (
Any,
NamedTuple,
)
class FormattedMetric(NamedTuple):
title: str
value: str
class JobMetricFormatter:
"""Format job metric key-value pairs for human consumption in Web UI."""
def format(self, key:... | """Utilities related to formatting job metrics for human consumption."""
from typing import (
Any,
NamedTuple,
)
class FormattedMetric(NamedTuple):
title: str
value: str
class JobMetricFormatter:
"""Format job metric key-value pairs for human consumption in Web UI."""
def format(self, key:... | |
45,738 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/formatting.py | 17,18 | 14,21 | format | JobMetricFormatter | 18,21 | 18,21 | class JobMetricFormatter:
"""Format job metric key-value pairs for human consumption in Web UI."""
def format(self, key: str, value: Any) -> FormattedMetric:
FILL_FUNC_BODY | class JobMetricFormatter:
"""Format job metric key-value pairs for human consumption in Web UI."""
def format(self, key: str, value: Any) -> FormattedMetric:
FILL_FUNC_BODY | return FormattedMetric(key, str(value))
| return FormattedMetric(key, str(value))
| 3 | 58 | 19 | 77 | """Utilities related to formatting job metrics for human consumption."""
from typing import (
Any,
NamedTuple,
)
class FormattedMetric(NamedTuple):
title: str
value: str
class JobMetricFormatter:
"""Format job metric key-value pairs for human consumption in Web UI."""
def format(self, key:... | """Utilities related to formatting job metrics for human consumption."""
from typing import (
Any,
NamedTuple,
)
class FormattedMetric(NamedTuple):
title: str
value: str
class JobMetricFormatter:
"""Format job metric key-value pairs for human consumption in Web UI."""
def format(self, key:... |
45,739 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/cgroup.py | 194,195 | 134,224 | __add_metric | CgroupPlugin | 195,198 | 195,198 | class CgroupPlugin(InstrumentPlugin):
"""Plugin that collects memory and cpu utilization from within a cgroup."""
plugin_type = "cgroup"
formatter = CgroupPluginFormatter()
def __init__(self, **kwargs):
self.verbose = asbool(kwargs.get("verbose", False))
self.cgroup_mount = kwargs.get(... | class CgroupPlugin(InstrumentPlugin):
"""Plugin that collects memory and cpu utilization from within a cgroup."""
plugin_type = "cgroup"
formatter = CgroupPluginFormatter()
def __init__(self, **kwargs):
self.verbose = asbool(kwargs.get("verbose", False))
self.cgroup_mount = kwargs.get(... | if metric and (metric.subkey in self.params or self.verbose):
metrics[metric.subkey] = metric.value
| if metric and (metric.subkey in self.params or self.verbose):
metrics[metric.subkey] = metric.value
| 11 | 983 | 37 | 1,020 | """The module describes the ``cgroup`` job metrics plugin."""
import logging
from collections import namedtuple
from typing import (
Any,
Dict,
List,
)
from galaxy.util import (
asbool,
nice_size,
)
from . import InstrumentPlugin
from .. import formatting
log = logging.getLogger(__name__)
VALID_... | """The module describes the ``cgroup`` job metrics plugin."""
import logging
from collections import namedtuple
from typing import (
Any,
Dict,
List,
)
from galaxy.util import (
asbool,
nice_size,
)
from . import InstrumentPlugin
from .. import formatting
log = logging.getLogger(__name__)
VALID_... |
45,740 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/cgroup.py | 115,116 | 114,134 | format | CgroupPluginFormatter | 116,134 | 116,134 | class CgroupPluginFormatter(formatting.JobMetricFormatter):
def format(self, key: str, value: Any) -> formatting.FormattedMetric:
FILL_FUNC_BODY | class CgroupPluginFormatter(formatting.JobMetricFormatter):
def format(self, key: str, value: Any) -> formatting.FormattedMetric:
FILL_FUNC_BODY | title = TITLES.get(key, key)
if key in CONVERSION:
return formatting.FormattedMetric(title, CONVERSION[key](value))
elif key.endswith("_bytes"):
try:
return formatting.FormattedMetric(title, nice_size(value))
except ValueError:
... | title = TITLES.get(key, key)
if key in CONVERSION:
return formatting.FormattedMetric(title, CONVERSION[key](value))
elif key.endswith("_bytes"):
try:
return formatting.FormattedMetric(title, nice_size(value))
except ValueError:
... | 38 | 52 | 167 | 219 | """The module describes the ``cgroup`` job metrics plugin."""
import logging
from collections import namedtuple
from typing import (
Any,
Dict,
List,
)
from galaxy.util import (
asbool,
nice_size,
)
from . import InstrumentPlugin
from .. import formatting
log = logging.getLogger(__name__)
VALID_... | """The module describes the ``cgroup`` job metrics plugin."""
import logging
from collections import namedtuple
from typing import (
Any,
Dict,
List,
)
from galaxy.util import (
asbool,
nice_size,
)
from . import InstrumentPlugin
from .. import formatting
log = logging.getLogger(__name__)
VALID_... |
45,741 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/core.py | 104,105 | 43,113 | __read_integer | CorePlugin | 105,113 | 105,113 | class CorePlugin(InstrumentPlugin):
"""Simple plugin that collects data without external dependencies. In
particular it currently collects value set for Galaxy slots.
"""
plugin_type = "core"
formatter = CorePluginFormatter()
default_safety = Safety.SAFE
def __init__(self, **kwargs):
... | class CorePlugin(InstrumentPlugin):
"""Simple plugin that collects data without external dependencies. In
particular it currently collects value set for Galaxy slots.
"""
plugin_type = "core"
formatter = CorePluginFormatter()
default_safety = Safety.SAFE
def __init__(self, **kwargs):
... | value = None
try:
value = int(open(path).read())
except Exception:
pass
return value
| value = None
try:
value = int(open(path).read())
except Exception:
pass
return value
| 12 | 891 | 43 | 934 | """The module describes the ``core`` job metrics plugin."""
import logging
import time
from typing import (
Any,
Dict,
List,
)
from . import InstrumentPlugin
from ..formatting import (
FormattedMetric,
JobMetricFormatter,
seconds_to_str,
)
from ..safety import Safety
log = logging.getLogger(_... | """The module describes the ``core`` job metrics plugin."""
import logging
import time
from typing import (
Any,
Dict,
List,
)
from . import InstrumentPlugin
from ..formatting import (
FormattedMetric,
JobMetricFormatter,
seconds_to_str,
)
from ..safety import Safety
log = logging.getLogger(_... |
45,742 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/core.py | 29,30 | 28,43 | format | CorePluginFormatter | 30,43 | 30,43 | class CorePluginFormatter(JobMetricFormatter):
def format(self, key: str, value: Any) -> FormattedMetric:
FILL_FUNC_BODY | class CorePluginFormatter(JobMetricFormatter):
def format(self, key: str, value: Any) -> FormattedMetric:
FILL_FUNC_BODY | value = int(value)
if key == GALAXY_SLOTS_KEY:
return FormattedMetric("Cores Allocated", "%d" % value)
elif key == GALAXY_MEMORY_MB_KEY:
return FormattedMetric("Memory Allocated (MB)", "%d" % value)
elif key == RUNTIME_SECONDS_KEY:
return FormattedMetr... | value = int(value)
if key == GALAXY_SLOTS_KEY:
return FormattedMetric("Cores Allocated", "%d" % value)
elif key == GALAXY_MEMORY_MB_KEY:
return FormattedMetric("Memory Allocated (MB)", "%d" % value)
elif key == RUNTIME_SECONDS_KEY:
return FormattedMetr... | 62 | 45 | 219 | 264 | """The module describes the ``core`` job metrics plugin."""
import logging
import time
from typing import (
Any,
Dict,
List,
)
from . import InstrumentPlugin
from ..formatting import (
FormattedMetric,
JobMetricFormatter,
seconds_to_str,
)
from ..safety import Safety
log = logging.getLogger(_... | """The module describes the ``core`` job metrics plugin."""
import logging
import time
from typing import (
Any,
Dict,
List,
)
from . import InstrumentPlugin
from ..formatting import (
FormattedMetric,
JobMetricFormatter,
seconds_to_str,
)
from ..safety import Safety
log = logging.getLogger(_... |
45,743 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/cpuinfo.py | 20,21 | 19,27 | format | CpuInfoFormatter | 21,27 | 21,27 | class CpuInfoFormatter(JobMetricFormatter):
def format(self, key: str, value: Any) -> FormattedMetric:
FILL_FUNC_BODY | class CpuInfoFormatter(JobMetricFormatter):
def format(self, key: str, value: Any) -> FormattedMetric:
FILL_FUNC_BODY | if key == "processor_count":
return FormattedMetric("Processor Count", f"{int(value)}")
else:
return super().format(key, value)
| if key == "processor_count":
return FormattedMetric("Processor Count", f"{int(value)}")
else:
return super().format(key, value)
| 12 | 46 | 52 | 98 | """The module describes the ``cpuinfo`` job metrics plugin."""
import logging
import re
from typing import Any
from galaxy import util
from . import InstrumentPlugin
from ..formatting import (
FormattedMetric,
JobMetricFormatter,
)
log = logging.getLogger(__name__)
PROCESSOR_LINE = re.compile(r"processor\s*... | """The module describes the ``cpuinfo`` job metrics plugin."""
import logging
import re
from typing import Any
from galaxy import util
from . import InstrumentPlugin
from ..formatting import (
FormattedMetric,
JobMetricFormatter,
)
log = logging.getLogger(__name__)
PROCESSOR_LINE = re.compile(r"processor\s*... |
45,744 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/cpuinfo.py | 41,42 | 27,68 | job_properties | CpuInfoPlugin | 42,64 | 42,64 | class CpuInfoPlugin(InstrumentPlugin):
"""Gather information about processor configuration from /proc/cpuinfo.
Linux only.
"""
plugin_type = "cpuinfo"
formatter = CpuInfoFormatter()
def __init__(self, **kwargs):
self.verbose = util.asbool(kwargs.get("verbose", False))
def pre_exec... | class CpuInfoPlugin(InstrumentPlugin):
"""Gather information about processor configuration from /proc/cpuinfo.
Linux only.
"""
plugin_type = "cpuinfo"
formatter = CpuInfoFormatter()
def __init__(self, **kwargs):
self.verbose = util.asbool(kwargs.get("verbose", False))
def pre_exec... | properties = {}
processor_count = 0
with open(self.__instrument_cpuinfo_path(job_directory)) as f:
current_processor = None
for line in f:
line = line.strip().lower()
if not line: # Skip empty lines
continue
... | properties = {}
processor_count = 0
with open(self.__instrument_cpuinfo_path(job_directory)) as f:
current_processor = None
for line in f:
line = line.strip().lower()
if not line: # Skip empty lines
continue
... | 70 | 204 | 230 | 434 | """The module describes the ``cpuinfo`` job metrics plugin."""
import logging
import re
from typing import Any
from galaxy import util
from . import InstrumentPlugin
from ..formatting import (
FormattedMetric,
JobMetricFormatter,
)
log = logging.getLogger(__name__)
PROCESSOR_LINE = re.compile(r"processor\s*... | """The module describes the ``cpuinfo`` job metrics plugin."""
import logging
import re
from typing import Any
from galaxy import util
from . import InstrumentPlugin
from ..formatting import (
FormattedMetric,
JobMetricFormatter,
)
log = logging.getLogger(__name__)
PROCESSOR_LINE = re.compile(r"processor\s*... |
45,745 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/env.py | 47,48 | 21,80 | job_properties | EnvPlugin | 51,76 | 48,76 | class EnvPlugin(InstrumentPlugin):
"""Instrumentation plugin capable of recording all or specific environment
variables for a job at runtime.
"""
plugin_type = "env"
formatter = EnvFormatter()
variables: Optional[List[str]]
default_safety = Safety.UNSAFE
def __init__(self, **kwargs):
... | class EnvPlugin(InstrumentPlugin):
"""Instrumentation plugin capable of recording all or specific environment
variables for a job at runtime.
"""
plugin_type = "env"
formatter = EnvFormatter()
variables: Optional[List[str]]
default_safety = Safety.UNSAFE
def __init__(self, **kwargs):
... | variables = self.variables
properties = {}
env_string = "".join(open(self.__env_file(job_directory)).readlines())
while env_string:
# Check if the next lines contain a shell function.
# We use '\n\}\n' as regex termination because shell
# functions ca... | """Recover environment variables dumped out on compute server and filter
out specific variables if needed.
"""
variables = self.variables
properties = {}
env_string = "".join(open(self.__env_file(job_directory)).readlines())
while env_string:
# Check ... | 114 | 336 | 316 | 652 | """The module describes the ``env`` job metrics plugin."""
import logging
import re
from typing import (
List,
Optional,
)
from . import InstrumentPlugin
from ..formatting import JobMetricFormatter
from ..safety import Safety
log = logging.getLogger(__name__)
class EnvFormatter(JobMetricFormatter):
pas... | """The module describes the ``env`` job metrics plugin."""
import logging
import re
from typing import (
List,
Optional,
)
from . import InstrumentPlugin
from ..formatting import JobMetricFormatter
from ..safety import Safety
log = logging.getLogger(__name__)
class EnvFormatter(JobMetricFormatter):
pas... |
45,746 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/hostname.py | 18,19 | 10,29 | pre_execute_instrument | HostnamePlugin | 19,21 | 19,21 | class HostnamePlugin(InstrumentPlugin):
"""Gather hostname"""
plugin_type = "hostname"
def __init__(self, **kwargs):
pass
def pre_execute_instrument(self, job_directory):
FILL_FUNC_BODY def job_properties(self, job_id, job_directory):
with open(self.__instrument_hostname_path(job_d... | class HostnamePlugin(InstrumentPlugin):
"""Gather hostname"""
plugin_type = "hostname"
def __init__(self, **kwargs):
pass
def pre_execute_instrument(self, job_directory):
FILL_FUNC_BODY def job_properties(self, job_id, job_directory):
with open(self.__instrument_hostname_path(job_d... | return f"hostname -f > '{self.__instrument_hostname_path(job_directory)}'"
| return f"hostname -f > '{self.__instrument_hostname_path(job_directory)}'"
| 5 | 165 | 30 | 195 | """The module describes the ``hostname`` job metrics plugin."""
import logging
from . import InstrumentPlugin
log = logging.getLogger(__name__)
class HostnamePlugin(InstrumentPlugin):
"""Gather hostname"""
plugin_type = "hostname"
def __init__(self, **kwargs):
pass
def pre_execute_instru... | """The module describes the ``hostname`` job metrics plugin."""
import logging
from . import InstrumentPlugin
log = logging.getLogger(__name__)
class HostnamePlugin(InstrumentPlugin):
"""Gather hostname"""
plugin_type = "hostname"
def __init__(self, **kwargs):
pass
def pre_execute_instru... |
45,747 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/meminfo.py | 18,19 | 17,23 | format | MemInfoFormatter | 19,23 | 19,23 | class MemInfoFormatter(formatting.JobMetricFormatter):
def format(self, key: str, value: Any) -> formatting.FormattedMetric:
FILL_FUNC_BODY | class MemInfoFormatter(formatting.JobMetricFormatter):
def format(self, key: str, value: Any) -> formatting.FormattedMetric:
FILL_FUNC_BODY | title = MEMINFO_TITLES.get(key, key)
return formatting.FormattedMetric(title, util.nice_size(value * 1000)) # kB = *1000, KB = *1024 - wikipedia
| title = MEMINFO_TITLES.get(key, key)
return formatting.FormattedMetric(title, util.nice_size(value * 1000)) # kB = *1000, KB = *1024 - wikipedia
| 18 | 51 | 72 | 123 | """The module describes the ``meminfo`` job metrics plugin."""
import re
from typing import Any
from galaxy import util
from . import InstrumentPlugin
from .. import formatting
from ..safety import Safety
MEMINFO_LINE = re.compile(r"(\w+)\s*\:\s*(\d+) kB")
# Important (non-verbose) meminfo property titles.
MEMINFO_... | """The module describes the ``meminfo`` job metrics plugin."""
import re
from typing import Any
from galaxy import util
from . import InstrumentPlugin
from .. import formatting
from ..safety import Safety
MEMINFO_LINE = re.compile(r"(\w+)\s*\:\s*(\d+) kB")
# Important (non-verbose) meminfo property titles.
MEMINFO_... |
45,748 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/meminfo.py | 38,39 | 23,61 | job_properties | MemInfoPlugin | 39,57 | 39,57 | class MemInfoPlugin(InstrumentPlugin):
"""Gather information about processor configuration from /proc/cpuinfo.
Linux only.
"""
plugin_type = "meminfo"
formatter = MemInfoFormatter()
default_safety = Safety.SAFE
def __init__(self, **kwargs):
self.verbose = util.asbool(kwargs.get("ve... | class MemInfoPlugin(InstrumentPlugin):
"""Gather information about processor configuration from /proc/cpuinfo.
Linux only.
"""
plugin_type = "meminfo"
formatter = MemInfoFormatter()
default_safety = Safety.SAFE
def __init__(self, **kwargs):
self.verbose = util.asbool(kwargs.get("ve... | properties = {}
with open(self.__instrument_meminfo_path(job_directory)) as f:
for line in f:
line = line.strip()
if not line: # Skip empty lines
continue
line_match = MEMINFO_LINE.match(line)
if not line_ma... | properties = {}
with open(self.__instrument_meminfo_path(job_directory)) as f:
for line in f:
line = line.strip()
if not line: # Skip empty lines
continue
line_match = MEMINFO_LINE.match(line)
if not line_ma... | 76 | 214 | 203 | 417 | """The module describes the ``meminfo`` job metrics plugin."""
import re
from typing import Any
from galaxy import util
from . import InstrumentPlugin
from .. import formatting
from ..safety import Safety
MEMINFO_LINE = re.compile(r"(\w+)\s*\:\s*(\d+) kB")
# Important (non-verbose) meminfo property titles.
MEMINFO_... | """The module describes the ``meminfo`` job metrics plugin."""
import re
from typing import Any
from galaxy import util
from . import InstrumentPlugin
from .. import formatting
from ..safety import Safety
MEMINFO_LINE = re.compile(r"(\w+)\s*\:\s*(\d+) kB")
# Important (non-verbose) meminfo property titles.
MEMINFO_... |
45,749 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/uname.py | 8,9 | 7,12 | format | UnameFormatter | 9,12 | 9,12 | class UnameFormatter(formatting.JobMetricFormatter):
def format(self, key, value):
FILL_FUNC_BODY | class UnameFormatter(formatting.JobMetricFormatter):
def format(self, key, value):
FILL_FUNC_BODY | return "Operating System", value
| return "Operating System", value
| 4 | 37 | 14 | 51 | """The module describes the ``uname`` job metrics plugin."""
from . import InstrumentPlugin
from .. import formatting
class UnameFormatter(formatting.JobMetricFormatter):
def format(self, key, value):
FILL_FUNC_BODYclass UnamePlugin(InstrumentPlugin):
"""Use uname to gather operating system information about... | """The module describes the ``uname`` job metrics plugin."""
from . import InstrumentPlugin
from .. import formatting
class UnameFormatter(formatting.JobMetricFormatter):
def format(self, key, value):
FILL_FUNC_BODYclass UnamePlugin(InstrumentPlugin):
"""Use uname to gather operating system information about... |
45,750 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/job_metrics/instrumenters/uname.py | 23,24 | 12,36 | pre_execute_instrument | UnamePlugin | 24,26 | 24,26 | class UnamePlugin(InstrumentPlugin):
"""Use uname to gather operating system information about remote system
job is running on. Linux only.
"""
plugin_type = "uname"
formatter = UnameFormatter()
def __init__(self, **kwargs):
self.uname_args = kwargs.get("args", "-a")
def pre_execu... | class UnamePlugin(InstrumentPlugin):
"""Use uname to gather operating system information about remote system
job is running on. Linux only.
"""
plugin_type = "uname"
formatter = UnameFormatter()
def __init__(self, **kwargs):
self.uname_args = kwargs.get("args", "-a")
def pre_execu... | return f"uname {self.uname_args} > '{self.__instrument_uname_path(job_directory)}'"
| return f"uname {self.uname_args} > '{self.__instrument_uname_path(job_directory)}'"
| 5 | 218 | 36 | 254 | """The module describes the ``uname`` job metrics plugin."""
from . import InstrumentPlugin
from .. import formatting
class UnameFormatter(formatting.JobMetricFormatter):
def format(self, key, value):
return "Operating System", value
class UnamePlugin(InstrumentPlugin):
"""Use uname to gather opera... | """The module describes the ``uname`` job metrics plugin."""
from . import InstrumentPlugin
from .. import formatting
class UnameFormatter(formatting.JobMetricFormatter):
def format(self, key, value):
return "Operating System", value
class UnamePlugin(InstrumentPlugin):
"""Use uname to gather opera... |
45,755 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/state_handler_factory.py | 13,14 | 1,22 | _get_state_handlers_dict | 14,22 | 14,22 | import logging
import galaxy.jobs.runners.state_handlers
from galaxy.util.submodules import import_submodules
log = logging.getLogger(__name__)
def build_state_handlers():
return _get_state_handlers_dict()
def _get_state_handlers_dict():
FILL_FUNC_BODY | import logging
import galaxy.jobs.runners.state_handlers
from galaxy.util.submodules import import_submodules
log = logging.getLogger(__name__)
def build_state_handlers():
return _get_state_handlers_dict()
def _get_state_handlers_dict():
FILL_FUNC_BODY | state_handlers = {}
for module in import_submodules(galaxy.jobs.runners.state_handlers, ordered=True):
for func in getattr(module, "__all__", []):
if func not in state_handlers:
state_handlers[func] = []
state_handlers[func].append(getattr(module, func))
... | state_handlers = {}
for module in import_submodules(galaxy.jobs.runners.state_handlers, ordered=True):
for func in getattr(module, "__all__", []):
if func not in state_handlers:
state_handlers[func] = []
state_handlers[func].append(getattr(module, func))
... | 35 | 90 | 132 | 222 | import logging
import galaxy.jobs.runners.state_handlers
from galaxy.util.submodules import import_submodules
log = logging.getLogger(__name__)
def build_state_handlers():
return _get_state_handlers_dict()
def _get_state_handlers_dict():
FILL_FUNC_BODY | import logging
import galaxy.jobs.runners.state_handlers
from galaxy.util.submodules import import_submodules
log = logging.getLogger(__name__)
def build_state_handlers():
return _get_state_handlers_dict()
def _get_state_handlers_dict():
FILL_FUNC_BODY | |
45,756 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/state_handlers/_safe_eval.py | 89,90 | 1,176 | _check_expression | 122,162 | 90,162 | from ast import (
parse,
walk,
)
AST_NODE_TYPE_ALLOWLIST = [
"Expr",
"Load",
"Str",
"Num",
"BoolOp",
"Compare",
"And",
"Eq",
"NotEq",
"Or",
"GtE",
"LtE",
"Lt",
"Gt",
"BinOp",
"Add",
"Div",
"Sub",
"Mult",
"Mod",
"Pow",
"LShi... | from ast import (
parse,
walk,
)
AST_NODE_TYPE_ALLOWLIST = [
"Expr",
"Load",
"Str",
"Num",
"BoolOp",
"Compare",
"And",
"Eq",
"NotEq",
"Or",
"GtE",
"LtE",
"Lt",
"Gt",
"BinOp",
"Add",
"Div",
"Sub",
"Mult",
"Mod",
"Pow",
"LShi... | if allowed_variables is None:
allowed_variables = []
try:
module = parse(text)
except SyntaxError:
return False
statements = module.body
if not len(statements) == 1:
return False
expression = statements[0]
if expression.__class__.__name__ != "Expr":
r... | """
>>> allowed_variables = ["c1", "c2", "c3", "c4", "c5"]
>>> _check_expression("c1", allowed_variables)
True
>>> _check_expression("eval('1+1')", allowed_variables)
False
>>> _check_expression("import sys", allowed_variables)
False
>>> _check_expression("[].__str__", allowed_varia... | 133 | 1,264 | 380 | 1,644 | from ast import (
parse,
walk,
)
AST_NODE_TYPE_ALLOWLIST = [
"Expr",
"Load",
"Str",
"Num",
"BoolOp",
"Compare",
"And",
"Eq",
"NotEq",
"Or",
"GtE",
"LtE",
"Lt",
"Gt",
"BinOp",
"Add",
"Div",
"Sub",
"Mult",
"Mod",
"Pow",
"LShi... | from ast import (
parse,
walk,
)
AST_NODE_TYPE_ALLOWLIST = [
"Expr",
"Load",
"Str",
"Num",
"BoolOp",
"Compare",
"And",
"Eq",
"NotEq",
"Or",
"GtE",
"LtE",
"Lt",
"Gt",
"BinOp",
"Add",
"Div",
"Sub",
"Mult",
"Mod",
"Pow",
"LShi... | |
45,758 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/state_handlers/resubmit.py | 119,120 | 114,161 | safe_eval | _ExpressionContext | 120,161 | 120,161 | class _ExpressionContext:
def __init__(self, job_state):
self._job_state = job_state
self._lazy_context = None
def safe_eval(self, condition):
FILL_FUNC_BODY | class _ExpressionContext:
def __init__(self, job_state):
self._job_state = job_state
self._lazy_context = None
def safe_eval(self, condition):
FILL_FUNC_BODY | if condition.isdigit():
return int(condition)
if self._lazy_context is None:
runner_state = getattr(self._job_state, "runner_state", None) or JobState.runner_states.UNKNOWN_ERROR
attempt = 1
now = datetime.utcnow()
last_running_state = None
... | if condition.isdigit():
return int(condition)
if self._lazy_context is None:
runner_state = getattr(self._job_state, "runner_state", None) or JobState.runner_states.UNKNOWN_ERROR
attempt = 1
now = datetime.utcnow()
last_running_state = None
... | 147 | 61 | 605 | 666 | import logging
from datetime import datetime
from galaxy import model
from galaxy.jobs.runners import JobState
from galaxy.model.base import transaction
from ._safe_eval import safe_eval
__all__ = ("failure",)
log = logging.getLogger(__name__)
MESSAGES = dict(
walltime_reached="it reached the walltime",
mem... | import logging
from datetime import datetime
from galaxy import model
from galaxy.jobs.runners import JobState
from galaxy.model.base import transaction
from ._safe_eval import safe_eval
__all__ = ("failure",)
log = logging.getLogger(__name__)
MESSAGES = dict(
walltime_reached="it reached the walltime",
mem... |
45,760 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/cli/factory.py | 17,18 | 1,21 | get_shell | 18,21 | 18,21 | try:
from galaxy.jobs.runners.util.cli import (
CliInterface,
split_params,
)
except ImportError:
from pulsar.managers.util.cli import ( # type: ignore[no-redef]
CliInterface,
split_params,
)
def build_cli_interface():
return CliInterface()
def get_shell(params):... | try:
from galaxy.jobs.runners.util.cli import (
CliInterface,
split_params,
)
except ImportError:
from pulsar.managers.util.cli import ( # type: ignore[no-redef]
CliInterface,
split_params,
)
def build_cli_interface():
return CliInterface()
def get_shell(params):... | cli_interface = build_cli_interface()
shell_params, _ = split_params(params)
return cli_interface.get_shell_plugin(shell_params)
| cli_interface = build_cli_interface()
shell_params, _ = split_params(params)
return cli_interface.get_shell_plugin(shell_params)
| 9 | 116 | 48 | 164 | try:
from galaxy.jobs.runners.util.cli import (
CliInterface,
split_params,
)
except ImportError:
from pulsar.managers.util.cli import ( # type: ignore[no-redef]
CliInterface,
split_params,
)
def build_cli_interface():
return CliInterface()
def get_shell(params):... | try:
from galaxy.jobs.runners.util.cli import (
CliInterface,
split_params,
)
except ImportError:
from pulsar.managers.util.cli import ( # type: ignore[no-redef]
CliInterface,
split_params,
)
def build_cli_interface():
return CliInterface()
def get_shell(params):... | |
45,761 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/cli/job/lsf.py | 50,51 | 23,148 | submit | LSF | 51,57 | 51,57 | class LSF(BaseJobExec):
def job_script_kwargs(self, ofile, efile, job_name):
scriptargs = {"-o": ofile, "-e": efile, "-J": job_name}
# Map arguments using argmap.
for k, v in self.params.items():
if k == "plugin" or k == "excluded_hosts":
continue
try... | class LSF(BaseJobExec):
def job_script_kwargs(self, ofile, efile, job_name):
scriptargs = {"-o": ofile, "-e": efile, "-J": job_name}
# Map arguments using argmap.
for k, v in self.params.items():
if k == "plugin" or k == "excluded_hosts":
continue
try... | # bsub returns Job <9147983> is submitted to default queue <research-rh7>.
# This should be really handled outside with something like
# parse_external. Currently CLI runner expect this to just send it in the last position
# of the string.
return f"bsub <{script_file} | awk '{{ p... | # bsub returns Job <9147983> is submitted to default queue <research-rh7>.
# This should be really handled outside with something like
# parse_external. Currently CLI runner expect this to just send it in the last position
# of the string.
return f"bsub <{script_file} | awk '{{ p... | 51 | 1,497 | 109 | 1,606 | # A simple CLI runner for slurm that can be used when running Galaxy from a
# non-submit host and using a Slurm cluster.
from logging import getLogger
from os import path
from . import (
BaseJobExec,
job_states,
)
from ... import runner_states
log = getLogger(__name__)
argmap = {
"memory": "-M", # There... | # A simple CLI runner for slurm that can be used when running Galaxy from a
# non-submit host and using a Slurm cluster.
from logging import getLogger
from os import path
from . import (
BaseJobExec,
job_states,
)
from ... import runner_states
log = getLogger(__name__)
argmap = {
"memory": "-M", # There... |
45,762 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/cli/job/pbs.py | 12,13 | 9,31 | get_status | OpenPBS | 13,15 | 13,15 | class OpenPBS(Torque):
ERROR_MESSAGE_UNRECOGNIZED_ARG = "Unrecognized long argument passed to OpenPBS CLI plugin: %s"
def get_status(self, job_ids=None):
FILL_FUNC_BODY def get_single_status(self, job_id):
return f"qstat -f {job_id}"
def parse_status(self, status, job_ids):
try:
... | class OpenPBS(Torque):
ERROR_MESSAGE_UNRECOGNIZED_ARG = "Unrecognized long argument passed to OpenPBS CLI plugin: %s"
def get_status(self, job_ids=None):
FILL_FUNC_BODY def get_single_status(self, job_id):
return f"qstat -f {job_id}"
def parse_status(self, status, job_ids):
try:
... | return "qstat -f -F json"
| return "qstat -f -F json"
| 5 | 248 | 15 | 263 | import json
from logging import getLogger
from .torque import Torque
log = getLogger(__name__)
class OpenPBS(Torque):
ERROR_MESSAGE_UNRECOGNIZED_ARG = "Unrecognized long argument passed to OpenPBS CLI plugin: %s"
def get_status(self, job_ids=None):
FILL_FUNC_BODY def get_single_status(self, job_id):
... | import json
from logging import getLogger
from .torque import Torque
log = getLogger(__name__)
class OpenPBS(Torque):
ERROR_MESSAGE_UNRECOGNIZED_ARG = "Unrecognized long argument passed to OpenPBS CLI plugin: %s"
def get_status(self, job_ids=None):
FILL_FUNC_BODY def get_single_status(self, job_id):
... |
45,763 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/cli/job/slurm.py | 67,68 | 15,80 | _get_job_state | Slurm | 68,80 | 68,80 | class Slurm(BaseJobExec):
def job_script_kwargs(self, ofile, efile, job_name):
scriptargs = {"-o": ofile, "-e": efile, "-J": job_name}
# Map arguments using argmap.
for k, v in self.params.items():
if k == "plugin":
continue
try:
if no... | class Slurm(BaseJobExec):
def job_script_kwargs(self, ofile, efile, job_name):
scriptargs = {"-o": ofile, "-e": efile, "-J": job_name}
# Map arguments using argmap.
for k, v in self.params.items():
if k == "plugin":
continue
try:
if no... | try:
return {
"F": job_states.ERROR,
"R": job_states.RUNNING,
"CG": job_states.RUNNING,
"PD": job_states.QUEUED,
"CD": job_states.OK,
}[state]
except KeyError:
raise KeyError(f"Failed to m... | try:
return {
"F": job_states.ERROR,
"R": job_states.RUNNING,
"CG": job_states.RUNNING,
"PD": job_states.QUEUED,
"CD": job_states.OK,
}[state]
except KeyError:
raise KeyError(f"Failed to m... | 27 | 568 | 119 | 687 | # A simple CLI runner for slurm that can be used when running Galaxy from a
# non-submit host and using a Slurm cluster.
from logging import getLogger
from . import (
BaseJobExec,
job_states,
)
log = getLogger(__name__)
argmap = {"time": "-t", "ncpus": "-c", "partition": "-p"}
class Slurm(BaseJobExec):
... | # A simple CLI runner for slurm that can be used when running Galaxy from a
# non-submit host and using a Slurm cluster.
from logging import getLogger
from . import (
BaseJobExec,
job_states,
)
log = getLogger(__name__)
argmap = {"time": "-t", "ncpus": "-c", "partition": "-p"}
class Slurm(BaseJobExec):
... |
45,764 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/cli/job/slurm_torque.py | 14,15 | 8,31 | get_status | SlurmTorque | 15,17 | 15,17 | class SlurmTorque(Torque):
"""A CLI job executor for Slurm's Torque compatibility mode. This differs
from real torque CLI in that -x command line is not available so job status
needs to be parsed from qstat table instead of XML.
"""
def get_status(self, job_ids=None):
FILL_FUNC_BODY def parse_st... | class SlurmTorque(Torque):
"""A CLI job executor for Slurm's Torque compatibility mode. This differs
from real torque CLI in that -x command line is not available so job status
needs to be parsed from qstat table instead of XML.
"""
def get_status(self, job_ids=None):
FILL_FUNC_BODY def parse_st... | return "qstat"
| return "qstat"
| 2 | 244 | 10 | 254 | import re
from .torque import Torque
__all__ = ("SlurmTorque",)
class SlurmTorque(Torque):
"""A CLI job executor for Slurm's Torque compatibility mode. This differs
from real torque CLI in that -x command line is not available so job status
needs to be parsed from qstat table instead of XML.
"""
... | import re
from .torque import Torque
__all__ = ("SlurmTorque",)
class SlurmTorque(Torque):
"""A CLI job executor for Slurm's Torque compatibility mode. This differs
from real torque CLI in that -x command line is not available so job status
needs to be parsed from qstat table instead of XML.
"""
... |
45,765 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/cli/job/torque.py | 64,65 | 36,110 | get_single_status | Torque | 65,67 | 65,67 | class Torque(BaseJobExec):
ERROR_MESSAGE_UNRECOGNIZED_ARG = "Unrecognized long argument passed to Torque CLI plugin: %s"
def job_script_kwargs(self, ofile, efile, job_name):
pbsargs = {"-o": ofile, "-e": efile, "-N": job_name}
for k, v in self.params.items():
if k == "plugin":
... | class Torque(BaseJobExec):
ERROR_MESSAGE_UNRECOGNIZED_ARG = "Unrecognized long argument passed to Torque CLI plugin: %s"
def job_script_kwargs(self, ofile, efile, job_name):
pbsargs = {"-o": ofile, "-e": efile, "-N": job_name}
for k, v in self.params.items():
if k == "plugin":
... | return f"qstat -f {job_id}"
| return f"qstat -f {job_id}"
| 4 | 814 | 17 | 831 | from logging import getLogger
from galaxy.util import parse_xml_string
from . import (
BaseJobExec,
job_states,
)
log = getLogger(__name__)
argmap = {
"destination": "-q",
"Execution_Time": "-a",
"Account_Name": "-A",
"Checkpoint": "-c",
"Error_Path": "-e",
"Group_List": "-g",
"H... | from logging import getLogger
from galaxy.util import parse_xml_string
from . import (
BaseJobExec,
job_states,
)
log = getLogger(__name__)
argmap = {
"destination": "-q",
"Execution_Time": "-a",
"Account_Name": "-A",
"Checkpoint": "-c",
"Error_Path": "-e",
"Group_List": "-g",
"H... |
45,766 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/cli/shell/local.py | 73,74 | 1,79 | _read_str | 74,78 | 74,78 | import os
from logging import getLogger
from subprocess import (
PIPE,
Popen,
)
from tempfile import TemporaryFile
from time import sleep
from galaxy.util.bunch import Bunch
from . import BaseShellExec
from ....util.process_groups import (
check_pg,
kill_pg,
)
log = getLogger(__name__)
TIMEOUT_ERROR_... | import os
from logging import getLogger
from subprocess import (
PIPE,
Popen,
)
from tempfile import TemporaryFile
from time import sleep
from galaxy.util.bunch import Bunch
from . import BaseShellExec
from ....util.process_groups import (
check_pg,
kill_pg,
)
log = getLogger(__name__)
TIMEOUT_ERROR_... | contents = stream.read()
return contents.decode("UTF-8") if isinstance(contents, bytes) else contents
| contents = stream.read()
return contents.decode("UTF-8") if isinstance(contents, bytes) else contents
| 10 | 725 | 35 | 760 | import os
from logging import getLogger
from subprocess import (
PIPE,
Popen,
)
from tempfile import TemporaryFile
from time import sleep
from galaxy.util.bunch import Bunch
from . import BaseShellExec
from ....util.process_groups import (
check_pg,
kill_pg,
)
log = getLogger(__name__)
TIMEOUT_ERROR_... | import os
from logging import getLogger
from subprocess import (
PIPE,
Popen,
)
from tempfile import TemporaryFile
from time import sleep
from galaxy.util.bunch import Bunch
from . import BaseShellExec
from ....util.process_groups import (
check_pg,
kill_pg,
)
log = getLogger(__name__)
TIMEOUT_ERROR_... | |
45,767 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/cli/shell/local.py | 51,54 | 25,73 | execute | LocalShell | 54,73 | 54,73 | class LocalShell(BaseShellExec):
"""
>>> shell = LocalShell()
>>> def exec_python(script, **kwds): return shell.execute(['python', '-c', script], **kwds)
>>> exec_result = exec_python("from __future__ import print_function; print('Hello World')")
>>> exec_result.stderr == u''
True
>>> exec_... | class LocalShell(BaseShellExec):
"""
>>> shell = LocalShell()
>>> def exec_python(script, **kwds): return shell.execute(['python', '-c', script], **kwds)
>>> exec_result = exec_python("from __future__ import print_function; print('Hello World')")
>>> exec_result.stderr == u''
True
>>> exec_... | is_cmd_string = isinstance(cmd, str)
outf = TemporaryFile()
p = Popen(cmd, stdin=None, stdout=outf, stderr=PIPE, shell=is_cmd_string, preexec_fn=os.setpgrp)
# check process group until timeout
for _ in range(int(timeout / timeout_check_interval)):
sleep(0.1) # For f... | is_cmd_string = isinstance(cmd, str)
outf = TemporaryFile()
p = Popen(cmd, stdin=None, stdout=outf, stderr=PIPE, shell=is_cmd_string, preexec_fn=os.setpgrp)
# check process group until timeout
for _ in range(int(timeout / timeout_check_interval)):
sleep(0.1) # For f... | 59 | 310 | 272 | 582 | import os
from logging import getLogger
from subprocess import (
PIPE,
Popen,
)
from tempfile import TemporaryFile
from time import sleep
from galaxy.util.bunch import Bunch
from . import BaseShellExec
from ....util.process_groups import (
check_pg,
kill_pg,
)
log = getLogger(__name__)
TIMEOUT_ERROR_... | import os
from logging import getLogger
from subprocess import (
PIPE,
Popen,
)
from tempfile import TemporaryFile
from time import sleep
from galaxy.util.bunch import Bunch
from . import BaseShellExec
from ....util.process_groups import (
check_pg,
kill_pg,
)
log = getLogger(__name__)
TIMEOUT_ERROR_... |
45,768 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/cli/shell/rsh.py | 94,95 | 55,113 | execute | ParamikoShell | 95,109 | 95,109 | class ParamikoShell:
def __init__(
self,
username,
hostname,
password=None,
private_key=None,
port=22,
timeout=60,
strict_host_key_checking=True,
**kwargs,
):
self.username = username
self.hostname = hostname
self.pa... | class ParamikoShell:
def __init__(
self,
username,
hostname,
password=None,
private_key=None,
port=22,
timeout=60,
strict_host_key_checking=True,
**kwargs,
):
self.username = username
self.hostname = hostname
self.pa... | def retry():
try:
_, stdout, stderr = self._execute(cmd, timeout)
except paramiko.SSHException as e:
log.error(e)
time.sleep(10)
self.connect()
_, stdout, stderr = self._execute(cmd, timeout)
retu... | def retry():
try:
_, stdout, stderr = self._execute(cmd, timeout)
except paramiko.SSHException as e:
log.error(e)
time.sleep(10)
self.connect()
_, stdout, stderr = self._execute(cmd, timeout)
retu... | 36 | 438 | 182 | 620 | import logging
import time
import paramiko
from pulsar.managers.util.retry import RetryActionExecutor
from galaxy.util import (
smart_str,
string_as_bool,
unicodify,
)
from galaxy.util.bunch import Bunch
from .local import LocalShell
log = logging.getLogger(__name__)
logging.getLogger("paramiko").setLeve... | import logging
import time
import paramiko
from pulsar.managers.util.retry import RetryActionExecutor
from galaxy.util import (
smart_str,
string_as_bool,
unicodify,
)
from galaxy.util.bunch import Bunch
from .local import LocalShell
log = logging.getLogger(__name__)
logging.getLogger("paramiko").setLeve... |
45,769 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/cli/shell/rsh.py | 31,32 | 21,42 | execute | RemoteShell | 32,42 | 32,42 | class RemoteShell(LocalShell):
def __init__(self, rsh="rsh", rcp="rcp", hostname="localhost", username=None, options=None, **kwargs):
super().__init__(**kwargs)
self.rsh = rsh
self.rcp = rcp
self.hostname = hostname
self.username = username
self.options = options
... | class RemoteShell(LocalShell):
def __init__(self, rsh="rsh", rcp="rcp", hostname="localhost", username=None, options=None, **kwargs):
super().__init__(**kwargs)
self.rsh = rsh
self.rcp = rcp
self.hostname = hostname
self.username = username
self.options = options
... | # TODO: implement persistence
fullcmd = [self.rsh]
if self.options:
fullcmd.extend(self.options)
if self.username:
fullcmd.extend(["-l", self.username])
fullcmd.extend([self.hostname, cmd])
return super().execute(fullcmd, persist, timeout)
| # TODO: implement persistence
fullcmd = [self.rsh]
if self.options:
fullcmd.extend(self.options)
if self.username:
fullcmd.extend(["-l", self.username])
fullcmd.extend([self.hostname, cmd])
return super().execute(fullcmd, persist, timeout)
| 20 | 135 | 99 | 234 | import logging
import time
import paramiko
from pulsar.managers.util.retry import RetryActionExecutor
from galaxy.util import (
smart_str,
string_as_bool,
unicodify,
)
from galaxy.util.bunch import Bunch
from .local import LocalShell
log = logging.getLogger(__name__)
logging.getLogger("paramiko").setLeve... | import logging
import time
import paramiko
from pulsar.managers.util.retry import RetryActionExecutor
from galaxy.util import (
smart_str,
string_as_bool,
unicodify,
)
from galaxy.util.bunch import Bunch
from .local import LocalShell
log = logging.getLogger(__name__)
logging.getLogger("paramiko").setLeve... |
45,770 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/external.py | 12,13 | 1,38 | parse_external_id | 27,38 | 13,38 | from re import search
EXTERNAL_ID_TYPE_ANY = None
EXTERNAL_ID_PATTERNS = [
("condor", r"submitted to cluster (\d+)\."),
("slurm", r"Submitted batch job (\w+)"),
("torque", r"(.+)"), # Default 'pattern' assumed by Galaxy code circa August 2013.
]
def parse_external_id(output, type=EXTERNAL_ID_TYPE_ANY):... | from re import search
EXTERNAL_ID_TYPE_ANY = None
EXTERNAL_ID_PATTERNS = [
("condor", r"submitted to cluster (\d+)\."),
("slurm", r"Submitted batch job (\w+)"),
("torque", r"(.+)"), # Default 'pattern' assumed by Galaxy code circa August 2013.
]
def parse_external_id(output, type=EXTERNAL_ID_TYPE_ANY):... | external_id = None
for pattern_type, pattern in EXTERNAL_ID_PATTERNS:
if type != EXTERNAL_ID_TYPE_ANY and type != pattern_type:
continue
match = search(pattern, output)
if match:
external_id = match.group(1)
break
return external_id
| """
Attempt to parse the output of job submission commands for an external id.__doc__
>>> parse_external_id("12345.pbsmanager")
'12345.pbsmanager'
>>> parse_external_id('Submitted batch job 185')
'185'
>>> parse_external_id('Submitted batch job 185', type='torque')
'Submitted batch job ... | 29 | 311 | 103 | 414 | from re import search
EXTERNAL_ID_TYPE_ANY = None
EXTERNAL_ID_PATTERNS = [
("condor", r"submitted to cluster (\d+)\."),
("slurm", r"Submitted batch job (\w+)"),
("torque", r"(.+)"), # Default 'pattern' assumed by Galaxy code circa August 2013.
]
def parse_external_id(output, type=EXTERNAL_ID_TYPE_ANY):... | from re import search
EXTERNAL_ID_TYPE_ANY = None
EXTERNAL_ID_PATTERNS = [
("condor", r"submitted to cluster (\d+)\."),
("slurm", r"Submitted batch job (\w+)"),
("torque", r"(.+)"), # Default 'pattern' assumed by Galaxy code circa August 2013.
]
def parse_external_id(output, type=EXTERNAL_ID_TYPE_ANY):... | |
45,771 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/fork_safe_write.py | 6,7 | 1,19 | fork_safe_write | 7,19 | 7,19 | import fcntl
from galaxy.util import unicodify
def fork_safe_write(path: str, contents: str):
FILL_FUNC_BODY | import fcntl
from galaxy.util import unicodify
def fork_safe_write(path: str, contents: str):
FILL_FUNC_BODY | # The following write method looks a little funky and is inspired by https://twitter.com/_monoid/status/1317895053122150400.
# This should guarantee that we wait until all forks that inherit open FDs have proceeded to execve,
# because only then the shared lock can be acquired.
# This **should** entirel... | # The following write method looks a little funky and is inspired by https://twitter.com/_monoid/status/1317895053122150400.
# This should guarantee that we wait until all forks that inherit open FDs have proceeded to execve,
# because only then the shared lock can be acquired.
# This **should** entirel... | 119 | 45 | 278 | 323 | import fcntl
from galaxy.util import unicodify
def fork_safe_write(path: str, contents: str):
FILL_FUNC_BODY | import fcntl
from galaxy.util import unicodify
def fork_safe_write(path: str, contents: str):
FILL_FUNC_BODY | |
45,772 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/kill.py | 24,25 | 1,70 | _psutil_kill_pid | 28,37 | 25,37 | import os
import signal
import subprocess
from platform import system
from time import sleep
try:
from psutil import (
NoSuchProcess,
Process,
)
except ImportError:
"""Don't make psutil a strict requirement, but use if available."""
Process = None
def kill_pid(pid: int, use_psutil: bo... | import os
import signal
import subprocess
from platform import system
from time import sleep
try:
from psutil import (
NoSuchProcess,
Process,
)
except ImportError:
"""Don't make psutil a strict requirement, but use if available."""
Process = None
def kill_pid(pid: int, use_psutil: bo... | try:
parent = Process(pid)
for child in parent.children(recursive=True):
child.kill()
parent.kill()
except NoSuchProcess:
return
| """
http://stackoverflow.com/questions/1230669/subprocess-deleting-child-processes-in-windows
"""
try:
parent = Process(pid)
for child in parent.children(recursive=True):
child.kill()
parent.kill()
except NoSuchProcess:
return
| 13 | 435 | 60 | 495 | import os
import signal
import subprocess
from platform import system
from time import sleep
try:
from psutil import (
NoSuchProcess,
Process,
)
except ImportError:
"""Don't make psutil a strict requirement, but use if available."""
Process = None
def kill_pid(pid: int, use_psutil: bo... | import os
import signal
import subprocess
from platform import system
from time import sleep
try:
from psutil import (
NoSuchProcess,
Process,
)
except ImportError:
"""Don't make psutil a strict requirement, but use if available."""
Process = None
def kill_pid(pid: int, use_psutil: bo... | |
45,773 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/runners/util/process_groups.py | 10,11 | 1,51 | check_pg | 12,30 | 11,30 | import errno
import logging
import os
import signal
from time import sleep
log = logging.getLogger(__name__)
def check_pg(pgid):
FILL_FUNC_BODYdef kill_pg(pgid):
"""Kill all processes in process group pgid."""
for sig in [signal.SIGTERM, signal.SIGKILL]:
try:
os.killpg(pgid, sig)
... | import errno
import logging
import os
import signal
from time import sleep
log = logging.getLogger(__name__)
def check_pg(pgid):
"""Check whether processes in process group pgid are still alive."""
FILL_FUNC_BODYdef kill_pg(pgid):
"""Kill all processes in process group pgid."""
for sig in [signal.SIGTERM... | try:
(pid, exit_status) = os.waitpid(-pgid, os.WNOHANG)
except OSError as e:
if e.errno == errno.ECHILD:
log.debug("check_pg(): No process found in process group %d", pgid)
else:
log.warning(
"check_pg(): Got errno %s when checking process group %d... | """Check whether processes in process group pgid are still alive."""
try:
(pid, exit_status) = os.waitpid(-pgid, os.WNOHANG)
except OSError as e:
if e.errno == errno.ECHILD:
log.debug("check_pg(): No process found in process group %d", pgid)
else:
log.warning(... | 64 | 291 | 200 | 491 | import errno
import logging
import os
import signal
from time import sleep
log = logging.getLogger(__name__)
def check_pg(pgid):
FILL_FUNC_BODYdef kill_pg(pgid):
"""Kill all processes in process group pgid."""
for sig in [signal.SIGTERM, signal.SIGKILL]:
try:
os.killpg(pgid, sig)
... | import errno
import logging
import os
import signal
from time import sleep
log = logging.getLogger(__name__)
def check_pg(pgid):
"""Check whether processes in process group pgid are still alive."""
FILL_FUNC_BODYdef kill_pg(pgid):
"""Kill all processes in process group pgid."""
for sig in [signal.SIGTERM... | |
45,774 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/splitters/basic.py | 24,25 | 1,28 | do_merge | 25,28 | 25,28 | import logging
from . import multi
log = logging.getLogger(__name__)
def set_basic_defaults(job_wrapper):
parent_job = job_wrapper.get_job()
parallelism = job_wrapper.get_parallelism()
parallelism.attributes["split_inputs"] = parent_job.input_datasets[0].name
parallelism.attributes["merge_outputs"] ... | import logging
from . import multi
log = logging.getLogger(__name__)
def set_basic_defaults(job_wrapper):
parent_job = job_wrapper.get_job()
parallelism = job_wrapper.get_parallelism()
parallelism.attributes["split_inputs"] = parent_job.input_datasets[0].name
parallelism.attributes["merge_outputs"] ... | # add in the missing information for splitting the one input and merging the one output
set_basic_defaults(job_wrapper)
return multi.do_merge(job_wrapper, task_wrappers)
| # add in the missing information for splitting the one input and merging the one output
set_basic_defaults(job_wrapper)
return multi.do_merge(job_wrapper, task_wrappers)
| 20 | 299 | 53 | 352 | import logging
from . import multi
log = logging.getLogger(__name__)
def set_basic_defaults(job_wrapper):
parent_job = job_wrapper.get_job()
parallelism = job_wrapper.get_parallelism()
parallelism.attributes["split_inputs"] = parent_job.input_datasets[0].name
parallelism.attributes["merge_outputs"] ... | import logging
from . import multi
log = logging.getLogger(__name__)
def set_basic_defaults(job_wrapper):
parent_job = job_wrapper.get_job()
parallelism = job_wrapper.get_parallelism()
parallelism.attributes["split_inputs"] = parent_job.input_datasets[0].name
parallelism.attributes["merge_outputs"] ... | |
45,776 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/jobs/stock_rules.py | 16,17 | 1,26 | burst | 17,24 | 17,24 | """ Stock job 'dynamic' rules for use in the job config file - these may cover some
simple use cases but will just proxy into functions in rule_helper so similar
functionality - but more tailored and composable can be utilized in custom
rules.
"""
from galaxy import util
def choose_one(rule_helper, job, destination_... | """ Stock job 'dynamic' rules for use in the job config file - these may cover some
simple use cases but will just proxy into functions in rule_helper so similar
functionality - but more tailored and composable can be utilized in custom
rules.
"""
from galaxy import util
def choose_one(rule_helper, job, destination_... | from_destination_ids = util.listify(from_destination_ids)
if rule_helper.should_burst(from_destination_ids, num_jobs=num_jobs, job_states=job_states):
return to_destination_id
else:
return from_destination_ids[0]
| from_destination_ids = util.listify(from_destination_ids)
if rule_helper.should_burst(from_destination_ids, num_jobs=num_jobs, job_states=job_states):
return to_destination_id
else:
return from_destination_ids[0]
| 12 | 253 | 91 | 344 | """ Stock job 'dynamic' rules for use in the job config file - these may cover some
simple use cases but will just proxy into functions in rule_helper so similar
functionality - but more tailored and composable can be utilized in custom
rules.
"""
from galaxy import util
def choose_one(rule_helper, job, destination_... | """ Stock job 'dynamic' rules for use in the job config file - these may cover some
simple use cases but will just proxy into functions in rule_helper so similar
functionality - but more tailored and composable can be utilized in custom
rules.
"""
from galaxy import util
def choose_one(rule_helper, job, destination_... | |
45,777 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/main_config.py | 38,39 | 1,114 | find_config | 39,53 | 39,53 | """Utilities for finding Galaxy's configuration file.
This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py).
"""
import os
from typing import (
List,
NamedTuple,
Optional,
)
from galaxy.util.properties import find_config_file
from galaxy.web_stack import get_app_kwds
DEFAULT_IN... | """Utilities for finding Galaxy's configuration file.
This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py).
"""
import os
from typing import (
List,
NamedTuple,
Optional,
)
from galaxy.util.properties import find_config_file
from galaxy.web_stack import get_app_kwds
DEFAULT_IN... | if supplied_config:
return supplied_config
if galaxy_root is None:
return os.path.abspath(f"{app_name}.yml")
for filename in default_relative_config_paths_for(app_name):
config_path = os.path.join(galaxy_root, filename)
if os.path.exists(config_path):
return con... | if supplied_config:
return supplied_config
if galaxy_root is None:
return os.path.abspath(f"{app_name}.yml")
for filename in default_relative_config_paths_for(app_name):
config_path = os.path.join(galaxy_root, filename)
if os.path.exists(config_path):
return con... | 24 | 1,202 | 123 | 1,325 | """Utilities for finding Galaxy's configuration file.
This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py).
"""
import os
from typing import (
List,
NamedTuple,
Optional,
)
from galaxy.util.properties import find_config_file
from galaxy.web_stack import get_app_kwds
DEFAULT_IN... | """Utilities for finding Galaxy's configuration file.
This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py).
"""
import os
from typing import (
List,
NamedTuple,
Optional,
)
from galaxy.util.properties import find_config_file
from galaxy.web_stack import get_app_kwds
DEFAULT_IN... | |
45,778 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/main_config.py | 89,90 | 72,114 | _resolve_config_file_path | WebappConfigResolver | 90,101 | 90,101 | class WebappConfigResolver:
def __init__(self, props: WebappSetupProps) -> None:
self.props = props
self.app_kwds = get_app_kwds(props.default_section_name, props.app_name)
self.config_file = self._resolve_config_file_path()
self.is_ini_file = config_is_ini(self.config_file)
... | class WebappConfigResolver:
def __init__(self, props: WebappSetupProps) -> None:
self.props = props
self.app_kwds = get_app_kwds(props.default_section_name, props.app_name)
self.config_file = self._resolve_config_file_path()
self.is_ini_file = config_is_ini(self.config_file)
... | config_file = self.app_kwds.get("config_file")
if not config_file and os.environ.get(self.props.env_config_file):
config_file = os.path.abspath(os.environ[self.props.env_config_file])
elif self.props.check_galaxy_root:
galaxy_root = self.app_kwds.get("galaxy_root") or os.... | config_file = self.app_kwds.get("config_file")
if not config_file and os.environ.get(self.props.env_config_file):
config_file = os.path.abspath(os.environ[self.props.env_config_file])
elif self.props.check_galaxy_root:
galaxy_root = self.app_kwds.get("galaxy_root") or os.... | 33 | 459 | 222 | 681 | """Utilities for finding Galaxy's configuration file.
This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py).
"""
import os
from typing import (
List,
NamedTuple,
Optional,
)
from galaxy.util.properties import find_config_file
from galaxy.web_stack import get_app_kwds
DEFAULT_IN... | """Utilities for finding Galaxy's configuration file.
This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py).
"""
import os
from typing import (
List,
NamedTuple,
Optional,
)
from galaxy.util.properties import find_config_file
from galaxy.web_stack import get_app_kwds
DEFAULT_IN... |
45,779 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/annotatable.py | 28,29 | 1,142 | _match_by_user | 29,37 | 29,37 | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... | if not user:
return None
for annotation in item.annotations:
if annotation.user_id == user.id:
return annotation.annotation
return None
| if not user:
return None
for annotation in item.annotations:
if annotation.user_id == user.id:
return annotation.annotation
return None
| 17 | 1,134 | 53 | 1,187 | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... | |
45,780 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/annotatable.py | 103,104 | 97,113 | deserialize_annotation | AnnotatableDeserializerMixin | 108,113 | 104,113 | class AnnotatableDeserializerMixin:
deserializers: Dict[str, Deserializer]
def add_deserializers(self):
self.deserializers["annotation"] = self.deserialize_annotation
def deserialize_annotation(self, item, key, val, user=None, **context):
FILL_FUNC_BODY | class AnnotatableDeserializerMixin:
deserializers: Dict[str, Deserializer]
def add_deserializers(self):
self.deserializers["annotation"] = self.deserialize_annotation
def deserialize_annotation(self, item, key, val, user=None, **context):
"""
Make sure `val` is a valid annotation a... | val = ModelValidator.nullable_basestring(key, val)
return self.manager.annotate(item, val, user=user, flush=False)
# TODO: I'm not entirely convinced this (or tags) are a good idea for filters since they involve a/the user
| """
Make sure `val` is a valid annotation and assign it, deleting any existing
if `val` is None.
"""
val = ModelValidator.nullable_basestring(key, val)
return self.manager.annotate(item, val, user=user, flush=False)
# TODO: I'm not entirely convinced this (or tags) are ... | 29 | 124 | 76 | 200 | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... |
45,781 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/annotatable.py | 131,132 | 113,142 | _add_parsers | AnnotatableFilterMixin | 132,142 | 132,142 | class AnnotatableFilterMixin:
fn_filter_parsers: FunctionFilterParsersType
def _owner_annotation(self, item) -> Optional[str]:
"""
Get the annotation by the item's owner.
"""
return _match_by_user(item, item.user)
def filter_annotation_contains(self, item, val: str) -> bool... | class AnnotatableFilterMixin:
fn_filter_parsers: FunctionFilterParsersType
def _owner_annotation(self, item) -> Optional[str]:
"""
Get the annotation by the item's owner.
"""
return _match_by_user(item, item.user)
def filter_annotation_contains(self, item, val: str) -> bool... | self.fn_filter_parsers.update(
{
"annotation": {
"op": {
"has": self.filter_annotation_contains,
"contains": self.filter_annotation_contains,
},
},
}
)
| self.fn_filter_parsers.update(
{
"annotation": {
"op": {
"has": self.filter_annotation_contains,
"contains": self.filter_annotation_contains,
},
},
}
)
| 14 | 185 | 77 | 262 | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... |
45,782 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/annotatable.py | 74,75 | 37,83 | _delete_annotation | AnnotatableManagerMixin | 75,83 | 75,83 | class AnnotatableManagerMixin:
#: class of AnnotationAssociation (e.g. HistoryAnnotationAssociation)
annotation_assoc: type
@abc.abstractmethod
def session(self) -> scoped_session: ...
def annotation(self, item) -> Optional[str]:
"""
Return the annotation string made by the `item`'... | class AnnotatableManagerMixin:
#: class of AnnotationAssociation (e.g. HistoryAnnotationAssociation)
annotation_assoc: type
@abc.abstractmethod
def session(self) -> scoped_session: ...
def annotation(self, item) -> Optional[str]:
"""
Return the annotation string made by the `item`'... | returned = item.delete_item_annotation(self.session(), user, item)
if flush:
session = self.session()
with transaction(session):
session.commit()
return returned
| returned = item.delete_item_annotation(self.session(), user, item)
if flush:
session = self.session()
with transaction(session):
session.commit()
return returned
| 15 | 360 | 60 | 420 | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... |
45,783 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/annotatable.py | 89,90 | 83,97 | serialize_annotation | AnnotatableSerializerMixin | 93,97 | 90,97 | class AnnotatableSerializerMixin:
serializers: Dict[str, Serializer]
def add_serializers(self):
self.serializers["annotation"] = self.serialize_annotation
def serialize_annotation(self, item, key, user=None, **context):
FILL_FUNC_BODY | class AnnotatableSerializerMixin:
serializers: Dict[str, Serializer]
def add_serializers(self):
self.serializers["annotation"] = self.serialize_annotation
def serialize_annotation(self, item, key, user=None, **context):
"""
Get and serialize an `item`'s annotation.
"""
FILL... | annotation = _match_by_user(item, user)
return annotation.strip() if annotation else None
| """
Get and serialize an `item`'s annotation.
"""
annotation = _match_by_user(item, user)
return annotation.strip() if annotation else None
| 10 | 101 | 32 | 133 | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... | """
Mixins for Annotatable model managers and serializers.
"""
import abc
import logging
from typing import (
Dict,
Optional,
)
from sqlalchemy.orm import scoped_session
from galaxy.model.base import transaction
from .base import (
Deserializer,
FunctionFilterParsersType,
ModelValidator,
Seri... |
45,784 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/api_keys.py | 36,37 | 16,62 | get_or_create_api_key | ApiKeyManager | 37,44 | 37,44 | class ApiKeyManager:
def __init__(self, app: BasicSharedApp):
self.app = app
self.session = self.app.model.context
def get_api_key(self, user: IsUserModel):
APIKeys = self.app.model.APIKeys
stmt = select(APIKeys).filter_by(user_id=user.id, deleted=False).order_by(APIKeys.create_... | class ApiKeyManager:
def __init__(self, app: BasicSharedApp):
self.app = app
self.session = self.app.model.context
def get_api_key(self, user: IsUserModel):
APIKeys = self.app.model.APIKeys
stmt = select(APIKeys).filter_by(user_id=user.id, deleted=False).order_by(APIKeys.create_... | # Logic Galaxy has always used - but it would appear to have a race
# condition. Worth fixing? Would kind of need a message queue to fix
# in multiple process mode.
api_key = self.get_api_key(user)
key = api_key.key if api_key else self.create_api_key(user).key
return key... | # Logic Galaxy has always used - but it would appear to have a race
# condition. Worth fixing? Would kind of need a message queue to fix
# in multiple process mode.
api_key = self.get_api_key(user)
key = api_key.key if api_key else self.create_api_key(user).key
return key... | 45 | 505 | 97 | 602 | from sqlalchemy import (
false,
select,
update,
)
from typing_extensions import Protocol
from galaxy.model.base import transaction
from galaxy.structured_app import BasicSharedApp
class IsUserModel(Protocol):
id: int
class ApiKeyManager:
def __init__(self, app: BasicSharedApp):
self.app... | from sqlalchemy import (
false,
select,
update,
)
from typing_extensions import Protocol
from galaxy.model.base import transaction
from galaxy.structured_app import BasicSharedApp
class IsUserModel(Protocol):
id: int
class ApiKeyManager:
def __init__(self, app: BasicSharedApp):
self.app... |
45,786 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/cloudauthzs.py | 83,84 | 75,128 | add_deserializers | CloudAuthzsDeserializer | 84,94 | 84,94 | class CloudAuthzsDeserializer(base.ModelDeserializer):
"""
Service object for validating and deserializing dictionaries that
update/alter cloudauthz configurations.
"""
model_manager_class = CloudAuthzManager
def add_deserializers(self):
FILL_FUNC_BODY def deserialize_and_validate_authn_id(... | class CloudAuthzsDeserializer(base.ModelDeserializer):
"""
Service object for validating and deserializing dictionaries that
update/alter cloudauthz configurations.
"""
model_manager_class = CloudAuthzManager
def add_deserializers(self):
FILL_FUNC_BODY def deserialize_and_validate_authn_id(... | super().add_deserializers()
self.deserializers.update(
{
"authn_id": self.deserialize_and_validate_authn_id,
"provider": self.default_deserializer,
"config": self.default_deserializer,
"description": self.default_deserializer,
... | super().add_deserializers()
self.deserializers.update(
{
"authn_id": self.deserialize_and_validate_authn_id,
"provider": self.default_deserializer,
"config": self.default_deserializer,
"description": self.default_deserializer,
... | 13 | 443 | 102 | 545 | """
Manager and (de)serializer for cloud authorizations (cloudauthzs).
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.exceptions import InternalServerError
from galaxy.managers import (
base,
sharable,
)
log = logging.getLogger(__name__)
class CloudAuthzManager(sharable.Sha... | """
Manager and (de)serializer for cloud authorizations (cloudauthzs).
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.exceptions import InternalServerError
from galaxy.managers import (
base,
sharable,
)
log = logging.getLogger(__name__)
class CloudAuthzManager(sharable.Sha... |
45,787 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/cloudauthzs.py | 51,52 | 23,75 | add_serializers | CloudAuthzsSerializer | 52,75 | 52,75 | class CloudAuthzsSerializer(base.ModelSerializer):
"""
Interface/service object for serializing cloud authorizations (cloudauthzs) into dictionaries.
"""
model_manager_class = CloudAuthzManager
def __init__(self, app, **kwargs):
super().__init__(app, **kwargs)
self.cloudauthzs_mana... | class CloudAuthzsSerializer(base.ModelSerializer):
"""
Interface/service object for serializing cloud authorizations (cloudauthzs) into dictionaries.
"""
model_manager_class = CloudAuthzManager
def __init__(self, app, **kwargs):
super().__init__(app, **kwargs)
self.cloudauthzs_mana... | super().add_serializers()
# Arguments of the following lambda functions:
# i : an instance of galaxy.model.CloudAuthz.
# k : serialized dictionary key (e.g., 'model_class', 'provider').
# **c: a dictionary containing 'trans' and 'user' objects.
serializers: Dict[str, b... | super().add_serializers()
# Arguments of the following lambda functions:
# i : an instance of galaxy.model.CloudAuthz.
# k : serialized dictionary key (e.g., 'model_class', 'provider').
# **c: a dictionary containing 'trans' and 'user' objects.
serializers: Dict[str, b... | 106 | 216 | 397 | 613 | """
Manager and (de)serializer for cloud authorizations (cloudauthzs).
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.exceptions import InternalServerError
from galaxy.managers import (
base,
sharable,
)
log = logging.getLogger(__name__)
class CloudAuthzManager(sharable.Sha... | """
Manager and (de)serializer for cloud authorizations (cloudauthzs).
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.exceptions import InternalServerError
from galaxy.managers import (
base,
sharable,
)
log = logging.getLogger(__name__)
class CloudAuthzManager(sharable.Sha... |
45,788 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/configuration.py | 241,242 | 235,258 | _defaults_to | AdminConfigSerializer | 242,244 | 242,244 | class AdminConfigSerializer(ConfigSerializer):
"""Configuration attributes viewable only by admin users"""
def add_serializers(self):
super().add_serializers()
def _defaults_to(default):
FILL_FUNC_BODY self.serializers.update(
{
# TODO: this is available from... | class AdminConfigSerializer(ConfigSerializer):
"""Configuration attributes viewable only by admin users"""
def add_serializers(self):
super().add_serializers()
def _defaults_to(default):
FILL_FUNC_BODY self.serializers.update(
{
# TODO: this is available from... | return lambda config, key, **context: getattr(config, key, default)
| return lambda config, key, **context: getattr(config, key, default)
| 8 | 282 | 24 | 306 | """
Managers, serializers for Galaxy config file data. ConfigSerializer for all users
and a more expanded set of data for admin in AdminConfigSerializer.
Used by both the API and bootstrapped data.
"""
import logging
import sys
from typing import (
Any,
Dict,
List,
)
from galaxy.managers import base
from... | """
Managers, serializers for Galaxy config file data. ConfigSerializer for all users
and a more expanded set of data for admin in AdminConfigSerializer.
Used by both the API and bootstrapped data.
"""
import logging
import sys
from typing import (
Any,
Dict,
List,
)
from galaxy.managers import base
from... |
45,790 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/configuration.py | 66,67 | 25,98 | tool_lineages | ConfigurationManager | 67,78 | 67,78 | class ConfigurationManager:
"""Interface/service object for interacting with configuration and related data."""
def __init__(self, app: StructuredApp):
self._app = app
def get_configuration(
self, trans: ProvidesUserContext, serialization_params: SerializationParams
) -> Dict[str, Any]... | class ConfigurationManager:
"""Interface/service object for interacting with configuration and related data."""
def __init__(self, app: StructuredApp):
self._app = app
def get_configuration(
self, trans: ProvidesUserContext, serialization_params: SerializationParams
) -> Dict[str, Any]... | rval = []
for id, tool in self._app.toolbox.tools():
try:
lineage_dict = tool.lineage.to_dict()
except AttributeError:
pass
else:
entry = {"id": id, "lineage": lineage_dict}
rval.append(entry)
ret... | rval = []
for id, tool in self._app.toolbox.tools():
try:
lineage_dict = tool.lineage.to_dict()
except AttributeError:
pass
else:
entry = {"id": id, "lineage": lineage_dict}
rval.append(entry)
ret... | 25 | 782 | 100 | 882 | """
Managers, serializers for Galaxy config file data. ConfigSerializer for all users
and a more expanded set of data for admin in AdminConfigSerializer.
Used by both the API and bootstrapped data.
"""
import logging
import sys
from typing import (
Any,
Dict,
List,
)
from galaxy.managers import base
from... | """
Managers, serializers for Galaxy config file data. ConfigSerializer for all users
and a more expanded set of data for admin in AdminConfigSerializer.
Used by both the API and bootstrapped data.
"""
import logging
import sys
from typing import (
Any,
Dict,
List,
)
from galaxy.managers import base
from... |
45,792 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/dbkeys.py | 93,94 | 79,169 | get_genome_build_names | GenomeBuilds | 94,121 | 94,121 | class GenomeBuilds:
default_value = "?"
default_name = "unspecified (?)"
def __init__(self, app, data_table_name="__dbkeys__", load_old_style=True):
self._app = app
self._data_table_name = data_table_name
self._static_chrom_info_path = app.config.len_file_path
# A dbkey can ... | class GenomeBuilds:
default_value = "?"
default_name = "unspecified (?)"
def __init__(self, app, data_table_name="__dbkeys__", load_old_style=True):
self._app = app
self._data_table_name = data_table_name
self._static_chrom_info_path = app.config.len_file_path
# A dbkey can ... | # FIXME: how to deal with key duplicates?
rval = [(self.default_value, self.default_name)]
# load user custom genome builds
if trans is not None:
if trans.history:
# This is a little bit Odd. We are adding every .len file in the current history to dbkey list,
... | # FIXME: how to deal with key duplicates?
rval = [(self.default_value, self.default_name)]
# load user custom genome builds
if trans is not None:
if trans.history:
# This is a little bit Odd. We are adding every .len file in the current history to dbkey list,
... | 173 | 926 | 478 | 1,404 | """
Functionality for dealing with dbkeys.
"""
import logging
import os.path
import re
from json import loads
from typing import (
Dict,
List,
Optional,
Tuple,
)
from sqlalchemy import select
from galaxy.model import HistoryDatasetAssociation
from galaxy.model.scoped_session import galaxy_scoped_sess... | """
Functionality for dealing with dbkeys.
"""
import logging
import os.path
import re
from json import loads
from typing import (
Dict,
List,
Optional,
Tuple,
)
from sqlalchemy import select
from galaxy.model import HistoryDatasetAssociation
from galaxy.model.scoped_session import galaxy_scoped_sess... |
45,793 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/deletable.py | 65,66 | 59,80 | deserialize_deleted | DeletableDeserializerMixin | 69,80 | 66,80 | class DeletableDeserializerMixin:
deserializers: Dict[str, Deserializer]
def add_deserializers(self):
self.deserializers["deleted"] = self.deserialize_deleted
def deserialize_deleted(self, item, key, val, **context):
FILL_FUNC_BODY | class DeletableDeserializerMixin:
deserializers: Dict[str, Deserializer]
def add_deserializers(self):
self.deserializers["deleted"] = self.deserialize_deleted
def deserialize_deleted(self, item, key, val, **context):
"""
Delete or undelete `item` based on `val` then return `item.de... | new_deleted = ModelValidator.bool(key, val)
if new_deleted == item.deleted:
return item.deleted
# TODO:?? flush=False?
if new_deleted:
self.manager.delete(item, flush=False)
else:
self.manager.undelete(item, flush=False)
return item.del... | """
Delete or undelete `item` based on `val` then return `item.deleted`.
"""
new_deleted = ModelValidator.bool(key, val)
if new_deleted == item.deleted:
return item.deleted
# TODO:?? flush=False?
if new_deleted:
self.manager.delete(item, fl... | 22 | 119 | 107 | 226 | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... |
45,794 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/deletable.py | 83,84 | 80,87 | _add_parsers | DeletableFiltersMixin | 84,87 | 84,87 | class DeletableFiltersMixin:
orm_filter_parsers: OrmFilterParsersType
def _add_parsers(self):
FILL_FUNC_BODY | class DeletableFiltersMixin:
orm_filter_parsers: OrmFilterParsersType
def _add_parsers(self):
FILL_FUNC_BODY | self.orm_filter_parsers.update({"deleted": {"op": ("eq"), "val": parse_bool}})
| self.orm_filter_parsers.update({"deleted": {"op": ("eq"), "val": parse_bool}})
| 5 | 51 | 36 | 87 | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... |
45,795 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/deletable.py | 44,45 | 27,51 | undelete | DeletableManagerMixin | 48,51 | 45,51 | class DeletableManagerMixin:
"""
A mixin/interface for a model that is deletable (i.e. has a 'deleted' attr).
Many resources in Galaxy can be marked as deleted - meaning (in most cases)
that they are no longer needed, should not be displayed, or may be actually
removed by an admin/script.
"""
... | class DeletableManagerMixin:
"""
A mixin/interface for a model that is deletable (i.e. has a 'deleted' attr).
Many resources in Galaxy can be marked as deleted - meaning (in most cases)
that they are no longer needed, should not be displayed, or may be actually
removed by an admin/script.
"""
... | return self._session_setattr(item, "deleted", False, flush=flush)
| """
Mark as not deleted and return.
"""
return self._session_setattr(item, "deleted", False, flush=flush)
| 5 | 215 | 27 | 242 | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... |
45,796 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/deletable.py | 54,55 | 51,59 | add_serializers | DeletableSerializerMixin | 55,59 | 55,59 | class DeletableSerializerMixin:
serializable_keyset: Set[str]
def add_serializers(self):
FILL_FUNC_BODY | class DeletableSerializerMixin:
serializable_keyset: Set[str]
def add_serializers(self):
FILL_FUNC_BODY | self.serializable_keyset.add("deleted")
# TODO: these are of questionable value if we don't want to enable users to delete/purge via update
| self.serializable_keyset.add("deleted")
# TODO: these are of questionable value if we don't want to enable users to delete/purge via update
| 19 | 42 | 47 | 89 | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... |
45,797 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/deletable.py | 117,118 | 114,134 | add_deserializers | PurgableDeserializerMixin | 118,121 | 118,121 | class PurgableDeserializerMixin(DeletableDeserializerMixin):
deserializers: Dict[str, Deserializer] = {}
def add_deserializers(self):
FILL_FUNC_BODY def deserialize_purged(self, item, key, val, **context):
"""
If `val` is True, purge `item` and return `item.purged`.
"""
new_p... | class PurgableDeserializerMixin(DeletableDeserializerMixin):
deserializers: Dict[str, Deserializer] = {}
def add_deserializers(self):
FILL_FUNC_BODY def deserialize_purged(self, item, key, val, **context):
"""
If `val` is True, purge `item` and return `item.purged`.
"""
new_p... | DeletableDeserializerMixin.add_deserializers(self)
self.deserializers["purged"] = self.deserialize_purged
| DeletableDeserializerMixin.add_deserializers(self)
self.deserializers["purged"] = self.deserialize_purged
| 4 | 194 | 43 | 237 | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... |
45,798 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/deletable.py | 135,136 | 134,138 | _add_parsers | PurgableFiltersMixin | 136,138 | 136,138 | class PurgableFiltersMixin(DeletableFiltersMixin):
def _add_parsers(self):
FILL_FUNC_BODY | class PurgableFiltersMixin(DeletableFiltersMixin):
def _add_parsers(self):
FILL_FUNC_BODY | DeletableFiltersMixin._add_parsers(self)
self.orm_filter_parsers.update({"purged": {"op": ("eq"), "val": parse_bool}})
| DeletableFiltersMixin._add_parsers(self)
self.orm_filter_parsers.update({"purged": {"op": ("eq"), "val": parse_bool}})
| 6 | 40 | 51 | 91 | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... |
45,799 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/deletable.py | 96,97 | 87,106 | purge | PurgableManagerMixin | 102,106 | 97,106 | class PurgableManagerMixin(DeletableManagerMixin):
"""
A manager interface/mixin for a resource that allows deleting and purging where
purging is often removal of some additional, non-db resource (e.g. a dataset's
file).
"""
def _session_setattr(self, item: Base, attr: str, val: Any, flush: boo... | class PurgableManagerMixin(DeletableManagerMixin):
"""
A manager interface/mixin for a resource that allows deleting and purging where
purging is often removal of some additional, non-db resource (e.g. a dataset's
file).
"""
def _session_setattr(self, item: Base, attr: str, val: Any, flush: boo... | self.delete(item, flush=False)
return self._session_setattr(item, "purged", True, flush=flush)
| """
Mark as purged and return.
Override this in subclasses to do the additional resource removal.
"""
self.delete(item, flush=False)
return self._session_setattr(item, "purged", True, flush=flush)
| 7 | 157 | 40 | 197 | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... |
45,800 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/deletable.py | 109,110 | 106,114 | add_serializers | PurgableSerializerMixin | 110,114 | 110,114 | class PurgableSerializerMixin(DeletableSerializerMixin):
serializable_keyset: Set[str]
def add_serializers(self):
FILL_FUNC_BODY | class PurgableSerializerMixin(DeletableSerializerMixin):
serializable_keyset: Set[str]
def add_serializers(self):
FILL_FUNC_BODY | DeletableSerializerMixin.add_serializers(self)
self.serializable_keyset.add("purged")
| DeletableSerializerMixin.add_serializers(self)
self.serializable_keyset.add("purged")
| 2 | 49 | 37 | 86 | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... | """
Many models in Galaxy are not meant to be removed from the database but only
marked as deleted. These models have the boolean attribute 'deleted'.
Other models are deletable and also may be purged. Most often these are
models have some backing/supporting resources that can be removed as well
(e.g. Datasets have da... |
45,801 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/display_applications.py | 63,64 | 33,89 | reload | DisplayApplicationsManager | 70,89 | 64,89 | class DisplayApplicationsManager:
"""Interface/service object for sharing logic between controllers."""
def __init__(self, app: StructuredApp):
self._app = app
@property
def datatypes_registry(self) -> Registry:
return self._app.datatypes_registry
def index(self) -> List[DisplayAp... | class DisplayApplicationsManager:
"""Interface/service object for sharing logic between controllers."""
def __init__(self, app: StructuredApp):
self._app = app
@property
def datatypes_registry(self) -> Registry:
return self._app.datatypes_registry
def index(self) -> List[DisplayAp... | self._app.queue_worker.send_control_task(
"reload_display_application", noop_self=True, kwargs={"display_application_ids": ids}
)
reloaded, failed = self.datatypes_registry.reload_display_applications(ids)
if not reloaded and failed:
message = 'Unable to reload an... | """
Reloads the list of display applications.
:param ids: list containing ids of display to be reloaded
:type ids: list
"""
self._app.queue_worker.send_control_task(
"reload_display_application", noop_self=True, kwargs={"display_application_ids": ids}
... | 93 | 325 | 303 | 628 | import logging
from typing import (
List,
Optional,
)
from pydantic import BaseModel
from galaxy.datatypes.registry import Registry
from galaxy.structured_app import StructuredApp
log = logging.getLogger(__name__)
class Link(BaseModel):
name: str
class DisplayApplication(BaseModel):
id: str
n... | import logging
from typing import (
List,
Optional,
)
from pydantic import BaseModel
from galaxy.datatypes.registry import Registry
from galaxy.structured_app import StructuredApp
log = logging.getLogger(__name__)
class Link(BaseModel):
name: str
class DisplayApplication(BaseModel):
id: str
n... |
45,802 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/executables.py | 15,16 | 1,51 | artifact_class | 16,50 | 16,50 | """Utilities for loading tools and workflows from paths for admin user requests."""
from typing import (
Any,
Dict,
Optional,
)
import yaml
from galaxy import exceptions
from galaxy.util import in_directory
def artifact_class(trans, as_dict: Dict[str, Any], allow_in_directory: Optional[str] = None):
FI... | """Utilities for loading tools and workflows from paths for admin user requests."""
from typing import (
Any,
Dict,
Optional,
)
import yaml
from galaxy import exceptions
from galaxy.util import in_directory
def artifact_class(trans, as_dict: Dict[str, Any], allow_in_directory: Optional[str] = None):
FI... | object_id = as_dict.get("object_id", None)
if as_dict.get("src", None) == "from_path":
workflow_path = as_dict.get("path")
allow = not trans or trans.user_is_admin
allow = allow or (allow_in_directory and in_directory(workflow_path, allow_in_directory))
if not allow:
... | object_id = as_dict.get("object_id", None)
if as_dict.get("src", None) == "from_path":
workflow_path = as_dict.get("path")
allow = not trans or trans.user_is_admin
allow = allow or (allow_in_directory and in_directory(workflow_path, allow_in_directory))
if not allow:
... | 103 | 113 | 386 | 499 | """Utilities for loading tools and workflows from paths for admin user requests."""
from typing import (
Any,
Dict,
Optional,
)
import yaml
from galaxy import exceptions
from galaxy.util import in_directory
def artifact_class(trans, as_dict: Dict[str, Any], allow_in_directory: Optional[str] = None):
FI... | """Utilities for loading tools and workflows from paths for admin user requests."""
from typing import (
Any,
Dict,
Optional,
)
import yaml
from galaxy import exceptions
from galaxy.util import in_directory
def artifact_class(trans, as_dict: Dict[str, Any], allow_in_directory: Optional[str] = None):
FI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.