clearml_agent/commands/worker.py
def _get_child_agents_count_for_worker(self):
        """Get the amount of running child agents. In case of any error return 0"""
        parent_worker_label = self._parent_worker_label.format(self.worker_id)
        cmd = [
            'docker',
            'ps',
            '--filter',
            'label={}'.format(parent_worker_label),
            '--format',
            # get some fields for debugging
            '{"ID":"{{ .ID }}", "Image": "{{ .Image }}", "Names":"{{ .Names }}", "Labels":"{{ .Labels }}"}'
        ]
        try:
            output = Argv(*cmd).get_output(
                stderr=subprocess.STDOUT
            )
        except subprocess.CalledProcessError as ex:
            self.log.warning("error getting child agents: %s", ex)
            return 0

        return len(output.splitlines()) if output else 0
Get the amount of running child agents. In case of any error return 0
Get the amount of running child agents. In case of any error return 0
Get the amount of running child agents . In case of any error return 0
def _get_child_agents_count_for_worker(self):
        parent_worker_label = self._parent_worker_label.format(self.worker_id)
        cmd = [
            'docker',
            'ps',
            '--filter',
            'label={}'.format(parent_worker_label),
            '--format',
            '{"ID":"{{ .ID }}", "Image": "{{ .Image }}", "Names":"{{ .Names }}", "Labels":"{{ .Labels }}"}'
        ]
        try:
            output = Argv(*cmd).get_output(
                stderr=subprocess.STDOUT
            )
        except subprocess.CalledProcessError as ex:
            self.log.warning("error getting child agents: %s", ex)
            return 0
        return len(output.splitlines()) if output else 0
def _get_child_agents_count_for_worker ( self ) : parent_worker_label = self . _parent_worker_label . format ( self . worker_id ) cmd = [ 'docker' , 'ps' , '--filter' , 'label={}' . format ( parent_worker_label ) , '--format' , '{"ID":"{{ .ID }}", "Image": "{{ .Image }}", "Names":"{{ .Names }}", "Labels":"{{ .Labels }}"}' ] try : output = Argv ( * cmd ) . get_output ( stderr = subprocess . STDOUT ) except subprocess . CalledProcessError as ex : self . log . warning ( "error getting child agents: %s" , ex ) return 0 return len ( output . splitlines ( ) ) if output else 0
Get the amount of running child agents.
Get the amount of running child agents .
"""Get the amount of running child agents. In case of any error return 0""" # get some fields for debugging
self