You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Никита Акельев a073752b90 Merge pull request 'IP-1440 Fix args pass' (#1) from IP-1440 into master 5 months ago
mesh_runner_agent IP-1440 Fix args pass 5 months ago
tests Tests 8 months ago
.gitignore Tests 8 months ago
Pipfile Tests 8 months ago
Pipfile.lock Tests 8 months ago
README.md Update docs 8 months ago
setup.py Add deps 7 months ago

README.md

Mesh runner agent

Quick start

  1. Add "mesh_runner_agent" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'mesh_runner_agent',
    ]
    
  2. Include the agent URLconf in your project urls.py like this:

    url(r'^runner/', include('mesh_runner_agent.urls', namespace='mesh_runner')),
    
  3. Add settings variables:

    MESH_RUNNER_ENABLED = bool(os.getenv('MESH_RUNNER_ENABLED', 0))
    MESH_RUNNER_HOST = os.getenv('MESH_RUNNER_HOST', "http://127.0.0.1:5555/")
    MESH_RUNNER_SERVICE_NAME = os.getenv('MESH_RUNNER_SERVICE_NAME', "PIM")
    MESH_RUNNER_ENVIRONMENT = os.getenv('MESH_RUNNER_ENVIRONMENT', "local")
    MESH_RUNNER_SECRET = os.getenv('MESH_RUNNER_SECRET', "123")
       
       
    def get_host() -> str:
        return urljoin("http://172.17.0.1:8000", reverse('mesh_runner:run_command'))
       
       
    MESH_RUNNER_HOST_GETTER = lazy(get_host, str)
    

Custom runner

To run commands of a non-standard manage file, you need to create a custom runner

# add decorator to register custom runner
@register_runner
class TenantManageCommandRunner(CommandRunner): # inherit your class from CommandRunner base class
    @classmethod
    def manage_filename(cls) -> str:
        return 'tenant_manage.py'

    def run(self) -> str:
        output = io.StringIO()
        runner = TenantCommandRunner((self.command, self.arguments), stdout=output, stderr=output)
        runner.run()
        output.flush()
        result = output.getvalue()
        output.close()
        return result