@experiment.command()<EOL>@click.option('<STR_LIT>', '<STR_LIT>', type=int, help="<STR_LIT>")<EOL>@click.option('<STR_LIT>', '<STR_LIT>', is_flag=True, help="<STR_LIT>")<EOL>@click.option('<STR_LIT>', '<STR_LIT>', is_flag=True, default=False,<EOL>help="<STR_LIT>")<EOL>@click.option('<STR_LIT>', is_flag=True, default=False,<EOL>help="<STR_LIT>")<EOL>@click.pass_context<EOL>@clean_outputs<EOL>def logs(ctx, job, past, follow, hide_time):
def get_experiment_logs():<EOL><INDENT>if past:<EOL><INDENT>try:<EOL><INDENT>response = PolyaxonClient().experiment.logs(<EOL>user, project_name, _experiment, stream=False)<EOL>get_logs_handler(handle_job_info=True,<EOL>show_timestamp=not hide_time,<EOL>stream=False)(response.content.decode().split('<STR_LIT:\n>'))<EOL>print()<EOL>if not follow:<EOL><INDENT>return<EOL><DEDENT><DEDENT>except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:<EOL><INDENT>if not follow:<EOL><INDENT>Printer.print_error(<EOL>'<STR_LIT>'.format(_experiment))<EOL>Printer.print_error(<EOL>'<STR_LIT>'.format(e))<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT><DEDENT>try:<EOL><INDENT>PolyaxonClient().experiment.logs(<EOL>user,<EOL>project_name,<EOL>_experiment,<EOL>message_handler=get_logs_handler(handle_job_info=True,<EOL>show_timestamp=not hide_time))<EOL><DEDENT>except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:<EOL><INDENT>Printer.print_error('<STR_LIT>'.format(_experiment))<EOL>Printer.print_error('<STR_LIT>'.format(e))<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>def get_experiment_job_logs():<EOL><INDENT>if past:<EOL><INDENT>try:<EOL><INDENT>response = PolyaxonClient().experiment_job.logs(<EOL>user,<EOL>project_name,<EOL>_experiment,<EOL>_job,<EOL>stream=False)<EOL>get_logs_handler(handle_job_info=True,<EOL>show_timestamp=not hide_time,<EOL>stream=False)(response.content.decode().split('<STR_LIT:\n>'))<EOL>print()<EOL>if not follow:<EOL><INDENT>return<EOL><DEDENT><DEDENT>except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:<EOL><INDENT>if not follow:<EOL><INDENT>Printer.print_error(<EOL>'<STR_LIT>'.format(_experiment))<EOL>Printer.print_error(<EOL>'<STR_LIT>'.format(e))<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT><DEDENT>try:<EOL><INDENT>PolyaxonClient().experiment_job.logs(<EOL>user,<EOL>project_name,<EOL>_experiment,<EOL>_job,<EOL>message_handler=get_logs_handler(handle_job_info=True,<EOL>show_timestamp=not hide_time))<EOL><DEDENT>except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:<EOL><INDENT>Printer.print_error('<STR_LIT>'.format(_job))<EOL>Printer.print_error('<STR_LIT>'.format(e))<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>user, project_name, _experiment = get_project_experiment_or_local(ctx.obj.get('<STR_LIT>'),<EOL>ctx.obj.get('<STR_LIT>'))<EOL>if job:<EOL><INDENT>_job = get_experiment_job_or_local(job)<EOL>get_experiment_job_logs()<EOL><DEDENT>else:<EOL><INDENT>get_experiment_logs()<EOL><DEDENT>
Get experiment or experiment job logs.

    Uses [Caching](/references/polyaxon-cli/#caching)

    Examples for getting experiment logs:

    \b
    ```bash
    $ polyaxon experiment logs
    ```

    \b
    ```bash
    $ polyaxon experiment -xp 10 -p mnist logs
    ```

    Examples for getting experiment job logs:

    \b
    ```bash
    $ polyaxon experiment -xp 1 -j 1 logs
    ```