How to use orchestra - 10 common examples

To help you get started, we’ve selected a few orchestra examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glic3rinu / django-orchestra / orchestra / contrib / mailboxes / admin.py View on Github external
def display_forward(self, address):
        forward_mailboxes = {m.name: m for m in address.get_forward_mailboxes()}
        values = []
        for forward in address.forward.split():
            mbox = forward_mailboxes.get(forward)
            if mbox:
                values.append(admin_link()(mbox))
            else:
                values.append(forward)
        return '<br>'.join(values)
    display_forward.short_description = _("Forward")
github glic3rinu / django-orchestra / orchestra / contrib / webapps / types / php.py View on Github external
# Disable functions
        if self.PHP_DISABLED_FUNCTIONS:
            enable_functions = init_vars.pop('enable_functions', None)
            enable_functions = OrderedSet(enable_functions.split(',') if enable_functions else ())
            disable_functions = init_vars.pop('disable_functions', None)
            disable_functions = OrderedSet(disable_functions.split(',') if disable_functions else ())
            if disable_functions or enable_functions or self.is_fpm:
                # FPM: Defining 'disable_functions' or 'disable_classes' will not overwrite previously
                #      defined php.ini values, but will append the new value
                for function in self.PHP_DISABLED_FUNCTIONS:
                    if function not in enable_functions:
                        disable_functions.add(function)
                init_vars['disable_functions'] = ','.join(disable_functions)
        # Process timeout
        if timeout:
            timeout = max(settings.WEBAPPS_PYTHON_DEFAULT_TIMEOUT, int(timeout))
            # Give a little slack here
            timeout = str(timeout-2)
            init_vars['max_execution_time'] = timeout
        # Custom error log
        if self.PHP_ERROR_LOG_PATH and 'error_log' not in init_vars:
            context = self.get_directive_context()
            error_log_path = os.path.normpath(self.PHP_ERROR_LOG_PATH % context)
            init_vars['error_log'] = error_log_path
        # Auto update max_post_size
        if 'upload_max_filesize' in init_vars:
            upload_max_filesize = init_vars['upload_max_filesize']
            post_max_size = init_vars.get('post_max_size', '0')
            upload_max_filesize_value = eval(upload_max_filesize.replace('M', '*1024'))
            post_max_size_value = eval(post_max_size.replace('M', '*1024'))
            init_vars['post_max_size'] = post_max_size
            if upload_max_filesize_value > post_max_size_value:
github glic3rinu / django-orchestra / orchestra / contrib / domains / models.py View on Github external
def get_records(self):
        types = set()
        records = utils.RecordStorage()
        for record in self.get_declared_records():
            types.add(record.type)
            if record.type == record.SOA:
                # Update serial and insert at 0
                value = record.value.split()
                value[2] = str(self.serial)
                records.insert(0, AttrDict(
                    type=record.SOA,
                    ttl=record.get_ttl(),
                    value=' '.join(value)
                ))
            else:
                records.append(AttrDict(
                    type=record.type,
                    ttl=record.get_ttl(),
                    value=record.value
                ))
        for record in self.get_default_records():
            if self.record_is_implicit(record, types):
                if record.type is Record.SOA:
                    records.insert(0, record)
                else:
                    records.append(record)
github glic3rinu / django-orchestra / orchestra / contrib / domains / models.py View on Github external
def get_records(self):
        types = set()
        records = utils.RecordStorage()
        for record in self.get_declared_records():
            types.add(record.type)
            if record.type == record.SOA:
                # Update serial and insert at 0
                value = record.value.split()
                value[2] = str(self.serial)
                records.insert(0, AttrDict(
                    type=record.SOA,
                    ttl=record.get_ttl(),
                    value=' '.join(value)
                ))
            else:
                records.append(AttrDict(
                    type=record.type,
                    ttl=record.get_ttl(),
                    value=record.value
                ))
        for record in self.get_default_records():
            if self.record_is_implicit(record, types):
                if record.type is Record.SOA:
                    records.insert(0, record)
                else:
                    records.append(record)
        return records
github b12io / orchestra / orchestra / utils / revert.py View on Github external
def _revert_task_from_audit(task_audit):
    task = Task.objects.get(id=task_audit['task']['id'])
    task.status = task_audit['reverted_status']
    task.save()
    for assignment_audit in task_audit['assignments']:
        _revert_assignment_from_audit(assignment_audit)
github glic3rinu / django-orchestra / orchestra / contrib / webapps / options.py View on Github external
name = 'magic_quotes_runtime'
    verbose_name = _("Magic quotes runtime")
    help_text = _("Functions that return data from any sort of external source will have quotes escaped "
                  "with a backslash (On or Off) <b>DEPRECATED as of PHP 5.3.0</b>.")
    regex = r'^(On|Off|on|off)$'
    deprecated = 5.3


class PHPMaginQuotesSybase(PHPAppOption):
    name = 'magic_quotes_sybase'
    verbose_name = _("Magic quotes sybase")
    help_text = _("Single-quote is escaped with a single-quote instead of a backslash (On or Off).")
    regex = r'^(On|Off|on|off)$'


class PHPMaxInputTime(PHPAppOption):
    name = 'max_input_time'
    verbose_name = _("Max input time")
    help_text = _("Maximum time in seconds a script is allowed to parse input data, like POST and GET "
                "(Integer between 0 and 999).")
    regex = r'^[0-9]{1,3}$'


class PHPMaxInputVars(PHPAppOption):
    name = 'max_input_vars'
    verbose_name = _("Max input vars")
    help_text = _("How many input variables may be accepted (limit is applied to $_GET, $_POST "
                "and $_COOKIE superglobal separately) (Integer between 0 and 9999).")
    regex = r'^[0-9]{1,4}$'


class PHPMemoryLimit(PHPAppOption):
github glic3rinu / django-orchestra / orchestra / contrib / webapps / options.py View on Github external
name = 'max_input_vars'
    verbose_name = _("Max input vars")
    help_text = _("How many input variables may be accepted (limit is applied to $_GET, $_POST "
                "and $_COOKIE superglobal separately) (Integer between 0 and 9999).")
    regex = r'^[0-9]{1,4}$'


class PHPMemoryLimit(PHPAppOption):
    name = 'memory_limit'
    verbose_name = _("Memory limit")
    help_text = _("This sets the maximum amount of memory in bytes that a script is allowed to allocate "
                  "(Value between 0M and 999M).")
    regex = r'^[0-9]{1,3}M$'


class PHPMySQLConnectTimeout(PHPAppOption):
    name = 'mysql.connect_timeout'
    verbose_name = _("Mysql connect timeout")
    help_text = _("Number between 0 and 999.")
    regex = r'^([0-9]){1,3}$'


class PHPOutputBuffering(PHPAppOption):
    name = 'output_buffering'
    verbose_name = _("Output buffering")
    help_text = _("Turn on output buffering (On or Off).")
    regex = r'^(On|Off|on|off)$'


class PHPRegisterGlobals(PHPAppOption):
    name = 'register_globals'
    verbose_name = _("Register globals")
github b12io / orchestra / orchestra / utils / revert.py View on Github external
{
                                'iteration': {...},
                                'change': 2
                            }
                        ]
                    },
                    {
                        # worker_1 assignment
                        'assignment': {...},
                        'change': 2,
                        'iterations': []
                    }
                ],
            }
    """
    task = Task.objects.get(id=task_id)
    revert_iteration = Iteration.objects.get(id=iteration_id)
    first_iteration = (
        revert_iteration.assignment.iterations
                        .order_by('start_datetime').first())
    if revert_before and revert_iteration != first_iteration:
        raise InvalidRevertError(
            "Cannot revert before an iteration that isn't the first of "
            "its assignment.")

    task_audit = _build_revert_audit(task, revert_iteration, revert_before)
    if commit:
        _revert_task_from_audit(task_audit)
    return task_audit
github b12io / orchestra / orchestra / utils / task_lifecycle.py View on Github external
completed_step_slugs = set(completed_tasks.values_list('step__slug',
                                                           flat=True))

    machine_tasks_to_schedule = []
    for step in all_steps:
        if step.slug in completed_step_slugs or Task.objects.filter(
                project=project, step=step).exists():
            continue

        if _are_desired_steps_completed_on_project(
                step.creation_depends_on, completed_tasks=completed_tasks):
            if _check_creation_policy(step, project):
                # create new task and task_assignment
                task = Task(step=step,
                            project=project,
                            status=Task.Status.AWAITING_PROCESSING)
                task.save()

                # Apply todolist templates to Task
                for template in task.step.todolist_templates_to_apply.all():
                    add_todolist_template(template.slug, task.id)

                _preassign_workers(task, AssignmentPolicyType.ENTRY_LEVEL)

                if not step.is_human:
                    machine_tasks_to_schedule.append(step)

    if len(machine_tasks_to_schedule) > 0:
        connection.on_commit(lambda: schedule_machine_tasks(
            project, machine_tasks_to_schedule))

    incomplete_tasks = (Task.objects.filter(project=project)
github b12io / orchestra / orchestra / utils / task_lifecycle.py View on Github external
# Apply todolist templates to Task
                for template in task.step.todolist_templates_to_apply.all():
                    add_todolist_template(template.slug, task.id)

                _preassign_workers(task, AssignmentPolicyType.ENTRY_LEVEL)

                if not step.is_human:
                    machine_tasks_to_schedule.append(step)

    if len(machine_tasks_to_schedule) > 0:
        connection.on_commit(lambda: schedule_machine_tasks(
            project, machine_tasks_to_schedule))

    incomplete_tasks = (Task.objects.filter(project=project)
                        .exclude(Q(status=Task.Status.COMPLETE) |
                                 Q(status=Task.Status.ABORTED)))

    if incomplete_tasks.count() == 0:
        if project.status != Project.Status.COMPLETED:
            set_project_status(project.id, 'Completed')
            archive_project_slack_group(project)