Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resources keeps increasing #364

Open
Trilokkumar1 opened this issue Dec 30, 2022 · 0 comments
Open

Resources keeps increasing #364

Trilokkumar1 opened this issue Dec 30, 2022 · 0 comments

Comments

@Trilokkumar1
Copy link

Trilokkumar1 commented Dec 30, 2022

`p = Protocol(
        endpoint=http_request+'://'+ip+':'+port+'/wsman',
        transport=transport_type,
        username=usr,
        password=passwrd,
        ca_trust_path="httpscert.cert",
        `server_cert_validation=isvalidation)``
# execute command by using command_id and shell_id
    try:
        shell_id = p.open_shell()
        command_id = p.run_command(shell_id, cmd)
        std_out, std_err, status_code = p.get_command_output(
            shell_id, command_id)
        # p.cleanup_command(shell_id, command_id)
        # p.close_shell(shell_id)
        file_status = status_code
        file_output = std_out +bytes(ANY_ERROR,UTF8) + std_err

    # if excpetion happend log exception with status code
    except Exception as exception:
        excp = (ANY_ERROR+'Exception:%s:%s' % (exception.__class__.__name__, exception))
        file_output = bytes(excp,UTF8)
    finally:
        p.cleanup_command(shell_id, command_id)
        p.close_shell(shell_id)
    # convert final output as bytes
    file_ip_bytes = bytes("windows:"+ip+"\n", UTF8)
    file_status_bytes = bytes("status_code:"+str(file_status)+"\n",UTF8)
    sep_bytes = bytes(FINAL_OUTPUT, UTF8)
    file_output = file_ip_bytes+file_status_bytes+sep_bytes+file_output
Writing into file and close.

Calling above python process from go. Initially it is consuming 28mb memory consumption increasing slowly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant