pulumi icon indicating copy to clipboard operation
pulumi copied to clipboard

`pulumi up` diagnostics are out of order

Open dixler opened this issue 3 years ago • 3 comments

What happened?

My pulumi is reordering my program output

"""An AWS Python Pulumi program"""

import pulumi
import time
from pulumi_aws import s3

# Create an AWS resource (S3 Bucket)
print('sample text 0')
pulumi.config.log.info('log 0')
bucket = s3.Bucket('bucket1')
time.sleep(2)
print('sample text 1')
pulumi.config.log.info('log 1')
bucket = s3.Bucket('bucket2', tags={
    'a': 'b'
})
bucket = s3.Bucket('bucket3', tags={
    'a': bucket.bucket,
})
raise Exception("aoeu")
time.sleep(2)
print('sample text 2')
pulumi.config.log.info('log 2')

# Export the name of the bucket
pulumi.export('bucket_name', bucket.bucket)

Steps to reproduce

run the program

Expected Behavior

Diagnostics:
  pulumi:pulumi:Stack (aws-python-dev):
    sample text 0
    log 0
    sample text 1
    log 1
    error: Program failed with an unhandled exception:
    error: Traceback (most recent call last):
      File "/home/kdixler/.pulumi-dev/bin/pulumi-language-python-exec", line 107, in <module>
        loop.run_until_complete(coro)
      File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
        return future.result()
      File "/home/kdixler/Documents/aws-python/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 126, in run_in_stack
        await run_pulumi_func(lambda: Stack(func))
      File "/home/kdixler/Documents/aws-python/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 49, in run_pulumi_func
        func()
      File "/home/kdixler/Documents/aws-python/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 126, in <lambda>
        await run_pulumi_func(lambda: Stack(func))
      File "/home/kdixler/Documents/aws-python/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 149, in __init__
        func()
      File "/home/kdixler/.pulumi-dev/bin/pulumi-language-python-exec", line 106, in <lambda>
        coro = pulumi.runtime.run_in_stack(lambda: runpy.run_path(args.PROGRAM, run_name='__main__'))
      File "/usr/lib/python3.10/runpy.py", line 306, in run_path
        return _run_code(code, mod_globals, init_globals,
      File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "/home/kdixler/Documents/aws-python/./__main__.py", line 20, in <module>
        raise Exception("aoeu")
    Exception: aoeu
    error: an unhandled error occurred: Program exited with non-zero exit code: 1

Actual Behavior

Diagnostics:
  pulumi:pulumi:Stack (aws-python-dev):
    log 0
    log 1
    error: Program failed with an unhandled exception:
    error: Traceback (most recent call last):
      File "/home/kdixler/.pulumi-dev/bin/pulumi-language-python-exec", line 107, in <module>
        loop.run_until_complete(coro)
      File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
        return future.result()
      File "/home/kdixler/Documents/aws-python/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 126, in run_in_stack
        await run_pulumi_func(lambda: Stack(func))
      File "/home/kdixler/Documents/aws-python/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 49, in run_pulumi_func
        func()
      File "/home/kdixler/Documents/aws-python/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 126, in <lambda>
        await run_pulumi_func(lambda: Stack(func))
      File "/home/kdixler/Documents/aws-python/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 149, in __init__
        func()
      File "/home/kdixler/.pulumi-dev/bin/pulumi-language-python-exec", line 106, in <lambda>
        coro = pulumi.runtime.run_in_stack(lambda: runpy.run_path(args.PROGRAM, run_name='__main__'))
      File "/usr/lib/python3.10/runpy.py", line 306, in run_path
        return _run_code(code, mod_globals, init_globals,
      File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "/home/kdixler/Documents/aws-python/./__main__.py", line 20, in <module>
        raise Exception("aoeu")
    Exception: aoeu
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
 
    sample text 0
    sample text 1

Versions used

CLI          
Version      3.35.3
Go Version   go1.17.11
Go Compiler  gc

Plugins
NAME    VERSION
aws     5.4.0
python  unknown

Host     
OS       arch
Version  21.3.1
Arch     x86_64

This project is written in python: executable='/home/kdixler/Documents/aws-python/venv/bin/python3' version='3.10.5'

Current Stack: dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/dixler
User           dixler
Organizations  dixler, EpicGames, pulumi

Dependencies:
NAME        VERSION
pip         22.1.2
pulumi-aws  5.4.0
setuptools  62.6.0
wheel       0.37.1

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

dixler avatar Jul 18 '22 18:07 dixler

To be more clear, standard out and the log messages are concatenated and the boundary isn't clear which makes debugging confusing.

dixler avatar Jul 18 '22 22:07 dixler

Given how we do logging, stdout, logs, stderr are separate because logs are categorized by resource with the stack being the default resource. This is by design.

dixler avatar Jul 28 '22 16:07 dixler

I'm looking at the events now and this does seem like a bug

asciicast

dixler avatar Jul 29 '22 19:07 dixler