def test_auto_namespace_not_matching_2(self): luigi.auto_namespace(scope='incorrect_namespace') class MyTask(luigi.Task): pass luigi.namespace(scope='incorrect_namespace') self.assertEqual(MyTask.get_task_namespace(), '')
def test_auto_namespace_global(self): luigi.auto_namespace() class MyTask(luigi.Task): pass luigi.namespace() self.assertEqual(MyTask.get_task_namespace(), self.this_module)
def test_auto_namespace_scope(self): luigi.auto_namespace(scope='task_test') luigi.namespace('bleh', scope='') class MyTask(luigi.Task): pass luigi.namespace(scope='task_test') luigi.namespace(scope='') self.assertEqual(MyTask.get_task_namespace(), self.this_module)
def run(self, tasks: List[luigi.task_register.Register], params: TYPING.PARAMS = dict(), return_value: bool = False, verbose: bool = True) -> TYPING.RETURN_VALURE: if verbose: logging.disable(0) else: logging.disable(sys.maxsize) luigi.auto_namespace(scope=__name__) luigi.task_register.Register.disable_instance_cache() params = self.config.make_running_params(params) task = InstantiationTask.run(tasks, params=params) luigi.build([task], local_scheduler=True) luigi.task_register.Register.clear_instance_cache() if return_value: output = task.output() if type(output) == list: return [x.load() for x in output] return output.load() return None
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import logging from enum import Enum, auto from functools import lru_cache import luigi luigi.auto_namespace(scope=__name__) class AuthorType(Enum): """enum for the various author types stored within the system""" USER = auto() BOT = auto() MANNEQUIN = auto() ORGANIZATION = auto() ENTERPRISE_USER_ACCOUNT = auto() UNKNOWN = auto() class Author: """class that contains the data for linking to an author, or editor or deleter"""
import luigi luigi.auto_namespace(scope=__name__)
""" This module provides a Luigi workflow """ import luigi # Enable automatic assignment of Luigi task namespace for all task classes under this module luigi.auto_namespace(__name__)
import luigi from luigi.util import requires, inherits from luigi import LocalTarget from luigi.file import TemporaryFile from fieldpathogenomics.luigi.slurm import SlurmExecutableTask, SlurmTask from fieldpathogenomics.utils import CheckTargetNonEmpty import fieldpathogenomics.utils as utils import Assemble PIPELINE = os.path.basename(__file__).split('.')[0] VERSION = '0.1' luigi.auto_namespace(scope=PIPELINE) # This information has to be filled in based on the output of # CollectISMetrics, obviously hardcoding it here is not good!!! INSERT_SIZES = {'LIB17363': 400, 'LIB26234': 800, 'LIB19826': 0, 'LIB19827': 0, 'LIB19828': 0, 'LIB19829': 0, 'LIB19830': 0, 'LIB19831': 0, 'LIB19832': 6000, 'LIB19833': 5000, 'LIB19834': 4000, 'LIB19835': 3500, 'LIB19836': 2500, 'LIB19837': 2100} # ------------------ Homozygous filter -------------------------- #
import luigi luigi.auto_namespace()
import luigi import numpy as np from pycarol.pipeline import inherit_list from pycarol.pipeline.task.kubernetestask import EasyKubernetesTask as Task import time luigi.auto_namespace(scope='teste') Task.is_cloud_target = True Task.DOCKER_IMAGE = 'gcr.io/labs-ai-apps-qa/test_rafael/test' class Task4(Task): def easy_run(self, input): print( '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' ) return [np.random.random() for _ in range(1000)] @inherit_list( Task4, ) class Task3(Task): def easy_run(self, input): time.sleep(10) return "asadsda"