Example #1
0
    def query(self, airflow_ts):
        check.opt_str_param(airflow_ts, 'airflow_ts')

        variables = construct_execute_plan_variables(
            self.recon_repo,
            self.mode,
            self.run_config,
            self.pipeline_name,
            self.run_id,
            self.step_keys,
        )
        tags = airflow_tags_for_ts(airflow_ts)
        variables['executionParams']['executionMetadata']['tags'] = tags

        self.log.info(
            'Executing GraphQL query: {query}\n'.format(query=RAW_EXECUTE_PLAN_MUTATION)
            + 'with variables:\n'
            + seven.json.dumps(variables, indent=2)
        )

        return [
            'dagster-graphql',
            '-v',
            '{}'.format(seven.json.dumps(variables)),
            '-t',
            '{}'.format(RAW_EXECUTE_PLAN_MUTATION),
        ]
Example #2
0
    def query(self, airflow_ts):
        check.opt_str_param(airflow_ts, "airflow_ts")

        variables = construct_execute_plan_variables(
            self.recon_repo,
            self.mode,
            self.run_config,
            self.pipeline_name,
            self.run_id,
            self.step_keys,
        )
        tags = airflow_tags_for_ts(airflow_ts)
        variables["executionParams"]["executionMetadata"]["tags"] = tags

        self.log.info("Executing GraphQL query: {query}\n".format(
            query=RAW_EXECUTE_PLAN_MUTATION) + "with variables:\n" +
                      seven.json.dumps(variables, indent=2))

        return [
            "dagster-graphql",
            "-v",
            "{}".format(seven.json.dumps(variables)),
            "-t",
            "{}".format(RAW_EXECUTE_PLAN_MUTATION),
        ]
Example #3
0
def invoke_steps_within_python_operator(invocation_args, ts, dag_run,
                                        **kwargs):  # pylint: disable=unused-argument
    mode = invocation_args.mode
    pipeline_name = invocation_args.pipeline_name
    step_keys = invocation_args.step_keys
    instance_ref = invocation_args.instance_ref
    run_config = invocation_args.run_config
    recon_repo = invocation_args.recon_repo
    pipeline_snapshot = invocation_args.pipeline_snapshot
    execution_plan_snapshot = invocation_args.execution_plan_snapshot
    parent_pipeline_snapshot = invocation_args.parent_pipeline_snapshot

    run_id = dag_run.run_id

    variables = construct_execute_plan_variables(recon_repo, mode, run_config,
                                                 pipeline_name, run_id,
                                                 step_keys)
    variables = add_airflow_tags(variables, ts)

    logging.info('Executing GraphQL query: {query}\n'.format(
        query=EXECUTE_PLAN_MUTATION) + 'with variables:\n' +
                 seven.json.dumps(variables, indent=2))
    instance = DagsterInstance.from_ref(instance_ref) if instance_ref else None
    if instance:
        instance.register_managed_run(
            pipeline_name=pipeline_name,
            run_id=run_id,
            run_config=run_config,
            mode=mode,
            solids_to_execute=None,
            step_keys_to_execute=None,
            tags=None,
            root_run_id=None,
            parent_run_id=None,
            pipeline_snapshot=pipeline_snapshot,
            execution_plan_snapshot=execution_plan_snapshot,
            parent_pipeline_snapshot=parent_pipeline_snapshot,
        )

    workspace = create_in_process_ephemeral_workspace(
        pointer=recon_repo.pointer)
    events = execute_execute_plan_mutation(
        workspace,
        variables,
        instance_ref=instance_ref,
    )
    check_events_for_failures(events)
    check_events_for_skips(events)
    return events
Example #4
0
    def query(self):
        variables = construct_execute_plan_variables(
            self.recon_repo,
            self.mode,
            self.run_config,
            self.pipeline_name,
            self.run_id,
            self.step_keys,
        )
        variables = add_airflow_tags(variables, self.airflow_ts)

        self.log.info(
            'Executing GraphQL query: {query}\n'.format(query=RAW_EXECUTE_PLAN_MUTATION)
            + 'with variables:\n'
            + seven.json.dumps(variables, indent=2)
        )

        return 'dagster-graphql -v \'{variables}\' -t \'{query}\''.format(
            variables=seven.json.dumps(variables), query=RAW_EXECUTE_PLAN_MUTATION
        )