コード例 #1
0
ファイル: runs_impl.py プロジェクト: jukiewiczm/guildai
def _apply_status_filter(args, filters):
    status_filters = [
        var.run_filter("attr", "status", status) for status in FILTERABLE
        if getattr(args, status, False)
    ]
    if status_filters:
        filters.append(var.run_filter("any", status_filters))
コード例 #2
0
def _runs_filter(oprefs, run_id_prefix, status):
    if run_id_prefix and isinstance(run_id_prefix, six.string_types):
        return lambda run: run.id.startswith(run_id_prefix)
    return var.run_filter("all", [
        var.run_filter("any", [
            var.run_filter("attr", "status", status_val)
            for status_val in status
        ]),
        var.run_filter("any", [opref_match_filter(opref) for opref in oprefs])
    ])
コード例 #3
0
def _apply_status_filter(args, filters):
    status = getattr(args, "status", None)
    if not status:
        return
    if status == "stopped":
        # Special case, filter on any of "terminated" or "error"
        filters.append(
            var.run_filter("any", [
                var.run_filter("attr", "status", "terminated"),
                var.run_filter("attr", "status", "error"),
            ]))
    else:
        filters.append(var.run_filter("attr", "status", status))
コード例 #4
0
ファイル: resolve.py プロジェクト: pombredanne/guild
 def _latest_op_run(self, opref):
     resolved_opref = self._fully_resolve_opref(opref)
     completed_op_runs = var.run_filter("all", [
         var.run_filter("any", [
             var.run_filter("attr", "status", "completed"),
             var.run_filter("attr", "status", "running"),
         ]), resolved_opref.is_op_run
     ])
     runs = var.runs(sort=["-started"], filter=completed_op_runs)
     if runs:
         return runs[0]
     raise ResolutionError("no suitable run for %s" %
                           self._opref_desc(resolved_opref))
コード例 #5
0
def _runs_filter(args):
    filters = []
    _apply_status_filter(args, filters)
    _apply_ops_filter(args, filters)
    _apply_labels_filter(args, filters)
    _apply_marked_filter(args, filters)
    return var.run_filter("all", filters)
コード例 #6
0
ファイル: runs_impl.py プロジェクト: skanuri/guildai
def _runs_filter(args, ctx):
    filters = []
    _apply_status_filter(args, filters)
    _apply_ops_filter(args, filters)
    _apply_labels_filter(args, filters)
    _apply_marked_filter(args, filters)
    _apply_started_filter(args, ctx, filters)
    _apply_sourcecode_digest_filter(args, filters)
    return var.run_filter("all", filters)
コード例 #7
0
def _runs_filter(oprefs, run_id_prefix, status):
    if _is_full_run_id(run_id_prefix):
        return lambda run: run.id == run_id_prefix
    return var.run_filter(
        "all",
        [
            _run_id_prefix_filter(run_id_prefix),
            _run_status_filter(status),
            _run_opref_filter(oprefs),
        ],
    )
コード例 #8
0
ファイル: resolver.py プロジェクト: yuanbw/guildai
def _runs_filter(oprefs, run_id_prefix):
    if run_id_prefix:
        return lambda run: run.id.startswith(run_id_prefix)
    return var.run_filter("all", [
        var.run_filter("any", [
            var.run_filter("attr", "status", "completed"),
            var.run_filter("attr", "status", "running"),
            var.run_filter("attr", "status", "terminated"),
        ]),
        var.run_filter("any", [opref_match_filter(opref) for opref in oprefs])
    ])
コード例 #9
0
ファイル: queue_main.py プロジェクト: yuanbw/guildai
def _running_runs():
    running = var.runs(filter=var.run_filter("attr", "status", "running"))
    return [run for run in running if run.id != RUN_ID]
コード例 #10
0
ファイル: queue_main.py プロジェクト: yuanbw/guildai
def _staged_runs():
    return var.runs(sort=["timestamp"],
                    filter=var.run_filter("attr", "status", "staged"))
コード例 #11
0
def _run_opref_filter(oprefs):
    return var.run_filter("any", [opref_match_filter(opref) for opref in oprefs])
コード例 #12
0
def _run_status_filter(status):
    return var.run_filter(
        "any", [var.run_filter("attr", "status", status_val) for status_val in status]
    )
コード例 #13
0
def _blocking_runs(state):
    if not state.wait_for_running:
        return []
    running = var.runs(filter=var.run_filter("attr", "status", "running"))
    return [run for run in running if not _is_queue_or_self(run, state)]
コード例 #14
0
def _running(state):
    running = var.runs(filter=var.run_filter("attr", "status", "running"))
    return [run for run in running if run.id != state.run_id]
コード例 #15
0
def _runs_filter(args):
    filters = []
    _apply_status_filter(args, filters)
    _apply_model_filter(args, filters)
    return var.run_filter("all", filters)
コード例 #16
0
ファイル: queue_main.py プロジェクト: databill86/guildai
def _running(state):
    running = var.runs(filter=var.run_filter("attr", "status", "running"))
    return [run for run in running if not _is_queue_or_self(run, state)]