Ejemplo n.º 1
0
def resolveRealResourcePath(packageResourcePath: str) -> Path:
    if packageResourcePath[0:1] != '@':
        raise Exception('Package resource path must start with @[packageName]')

    firstSlashPosition = packageResourcePath.find('/')
    rootModuleName = packageResourcePath[1:firstSlashPosition]
    rootModulePath = resolvePath(rootModuleName)

    return Path(rootModulePath + packageResourcePath[firstSlashPosition:])
Ejemplo n.º 2
0
def initContainer(appEnv) -> ContainerInterface:
    class Kernel(BaseKernel):
        def _registerBundles(self) -> List[Bundle]:
            return [ConsoleBundle(), DbxDeployBundle()]

    kernel = Kernel(appEnv,
                    resolvePath('dbxdeploy') + '/_config', YamlConfigReader())

    return kernel.initContainer()
    def __createContainer(self, appEnv: str):
        class Kernel(BaseKernel):

            _allowedEnvironments = ['test_aws', 'test_azure', 'test_test']

            def _registerBundles(self) -> List[Bundle]:
                return [
                    DatabricksBundle('spark_test.yaml')
                ]

        kernel = Kernel(
            appEnv,
            resolvePath('databricksbundle') + '/_config',
            YamlConfigReader()
        )

        return kernel.initContainer()
Ejemplo n.º 4
0
    def resolve(self, dtypeStr: str) -> DType:
        lastDotIndex = dtypeStr.rfind('.')

        className = dtypeStr[lastDotIndex + 1:]
        rootModuleName = dtypeStr[:dtypeStr.find('.')]

        rootModulePath = resolvePath(rootModuleName)

        filePath = rootModulePath[:-len(rootModuleName)] + dtypeStr.replace('.', '/') + '.py'

        if path.exists(filePath):
            # from foo.bar.HelloClass import HelloClass
            moduleName = dtypeStr
        else:
            # from foo.bar import HelloClass
            moduleName = dtypeStr[:lastDotIndex]

        return DType(moduleName, className)
    def test_init(self):
        class Kernel(BaseKernel):

            def _registerBundles(self) -> List[Bundle]:
                return [
                    PyfonyBundle(),
                    DatabricksBundle()
                ]

        kernel = Kernel(
            'test',
            resolvePath('databricksbundle') + '/DatabricksBundleTest',
            YamlConfigReader()
        )

        container = kernel.initContainer()

        testServices(container)