Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster-graphql/dagster_graphql/schema/external.py
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | class Meta(object): | ||||
name = "RepositoryLocationOrLoadFailure" | name = "RepositoryLocationOrLoadFailure" | ||||
types = ("RepositoryLocation", "RepositoryLocationLoadFailure") | types = ("RepositoryLocation", "RepositoryLocationLoadFailure") | ||||
class DauphinRepositoryLocation(dauphin.ObjectType): | class DauphinRepositoryLocation(dauphin.ObjectType): | ||||
class Meta(object): | class Meta(object): | ||||
name = "RepositoryLocation" | name = "RepositoryLocation" | ||||
id = dauphin.NonNull(dauphin.ID) | |||||
name = dauphin.NonNull(dauphin.String) | name = dauphin.NonNull(dauphin.String) | ||||
is_reload_supported = dauphin.NonNull(dauphin.Boolean) | is_reload_supported = dauphin.NonNull(dauphin.Boolean) | ||||
environment_path = dauphin.String() | environment_path = dauphin.String() | ||||
repositories = dauphin.non_null_list("Repository") | repositories = dauphin.non_null_list("Repository") | ||||
def __init__(self, location): | def __init__(self, location): | ||||
self._location = check.inst_param(location, "location", RepositoryLocation) | self._location = check.inst_param(location, "location", RepositoryLocation) | ||||
environment_path = ( | environment_path = ( | ||||
location.location_handle.executable_path | location.location_handle.executable_path | ||||
if isinstance(location.location_handle, ManagedGrpcPythonEnvRepositoryLocationHandle) | if isinstance(location.location_handle, ManagedGrpcPythonEnvRepositoryLocationHandle) | ||||
else None | else None | ||||
) | ) | ||||
check.invariant(location.name is not None) | check.invariant(location.name is not None) | ||||
super(DauphinRepositoryLocation, self).__init__( | super(DauphinRepositoryLocation, self).__init__( | ||||
name=location.name, | name=location.name, | ||||
environment_path=environment_path, | environment_path=environment_path, | ||||
is_reload_supported=location.is_reload_supported, | is_reload_supported=location.is_reload_supported, | ||||
) | ) | ||||
def resolve_id(self, _): | |||||
return self.name | |||||
def resolve_repositories(self, graphene_info): | def resolve_repositories(self, graphene_info): | ||||
return [ | return [ | ||||
graphene_info.schema.type_named("Repository")(repository, self._location) | graphene_info.schema.type_named("Repository")(repository, self._location) | ||||
for repository in self._location.get_repositories().values() | for repository in self._location.get_repositories().values() | ||||
] | ] | ||||
class DauphinRepositoryLocationLoadFailure(dauphin.ObjectType): | class DauphinRepositoryLocationLoadFailure(dauphin.ObjectType): | ||||
class Meta(object): | class Meta(object): | ||||
name = "RepositoryLocationLoadFailure" | name = "RepositoryLocationLoadFailure" | ||||
id = dauphin.NonNull(dauphin.ID) | |||||
name = dauphin.NonNull(dauphin.String) | name = dauphin.NonNull(dauphin.String) | ||||
error = dauphin.NonNull("PythonError") | error = dauphin.NonNull("PythonError") | ||||
def __init__(self, name, error): | def __init__(self, name, error): | ||||
check.str_param(name, "name") | check.str_param(name, "name") | ||||
check.inst_param(error, "error", SerializableErrorInfo) | check.inst_param(error, "error", SerializableErrorInfo) | ||||
super(DauphinRepositoryLocationLoadFailure, self).__init__( | super(DauphinRepositoryLocationLoadFailure, self).__init__( | ||||
name=name, error=DauphinPythonError(error) | name=name, error=DauphinPythonError(error) | ||||
) | ) | ||||
def resolve_id(self, _): | |||||
return self.name | |||||
class DauphinCodePointer(dauphin.ObjectType): | class DauphinCodePointer(dauphin.ObjectType): | ||||
class Meta(object): | class Meta(object): | ||||
name = "CodePointer" | name = "CodePointer" | ||||
description = dauphin.NonNull(dauphin.String) | description = dauphin.NonNull(dauphin.String) | ||||
metadata = dauphin.non_null_list("CodePointerMetadata") | metadata = dauphin.non_null_list("CodePointerMetadata") | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |