Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.89k stars 1.21k forks source link

zappa invoke --raw output limited and truncated on screen #2157

Open casualuser opened 3 years ago

casualuser commented 3 years ago

Context

Output from "zappa invoke --raw" command limited and truncated on screen for quite long data like json object

Expected Behavior

I've struggled a lot to get access manually to data in some tables without interactive shell support so used this raw command. For sure I was in the impression that print will output the whole JSON object but it was truncated and only last part printed.

Actual Behavior

(env) ➜  plnq-app git:(prod) ✗ zappa invoke --raw dev 'from projectfiddle.models import Iteration; iterations = Iteration.objects.all(); print(iterations[39].data);'
Calling invoke for stage dev..
2-2021","effort":10,"pk":99},{"title":"Deployment","type":2,"status":"OPEN","client_visible":true,"scheduled_start_date":null,"effort":null,"pk":100},{"title":"Deliverable: Pilot Deployment Plan","type":4,"status":"OPEN","client_visible":true,"scheduled_start_date":"23-11-2020","effort":4,"pk":101},{"title":"Deliverable: Deployment Plan","type":4,"status":"OPEN","client_visible":true,"scheduled_start_date":"11-01-2021","effort":4,"pk":102},{"title":"Deliverable: Rollback Plan","type":4,"status":"OPEN","client_visible":true,"scheduled_start_date":"11-01-2021","effort":1,"pk":103},{"title":"Deployment roles and responsibilities meeting","type":5,"status":"OPEN","client_visible":true,"scheduled_start_date":"15-02-2021","effort":2,"pk":104},{"title":"Deployment practice run","type":5,"status":"OPEN","client_visible":true,"scheduled_start_date":"22-02-2021","effort":0.5,"pk":105},{"title":"Go/no-go meeting","type":5,"status":"OPEN","client_visible":true,"scheduled_start_date":"01-03-2021","effort":0.25,"pk":106},{"title":"Deployment to live environment","type":5,"status":"OPEN","client_visible":true,"scheduled_start_date":"01-03-2021","effort":1,"pk":107},{"title":"Release Testing","type":2,"status":"OPEN","client_visible":true,"scheduled_start_date":null,"effort":null,"pk":108},{"title":"Conduct release testing","type":5,"status":"OPEN","client_visible":true,"scheduled_start_date":"01-03-2021","effort":1.5,"pk":109,"labels":[1]},{"title":"Conduct data spot-check","type":5,"status":"OPEN","client_visible":true,"scheduled_start_date":"01-03-2021","effort":0.5,"pk":110,"labels":[1]},{"title":"Hypercare","type":2,"status":"OPEN","client_visible":true,"scheduled_start_date":null,"effort":null,"pk":111,"milestones":[5]},{"title":"Hypercare period","type":5,"status":"OPEN","client_visible":true,"scheduled_start_date":"01-03-2021","effort":20,"pk":112},{"title":"PROJECT CLOSURE","type":1,"status":"OPEN","client_visible":true,"scheduled_start_date":null,"effort":"\r
","pk":113,"dependencies":[36]},{"title":"Lessons Learned meeting","type":5,"status":"OPEN","client_visible":true,"scheduled_start_date":"08-03-2021","effort":1,"pk":114}],"milestonesData":[{"title":"Project scope defined","label":"Project scope defined","pk":1,"id":1},{"title":"Product selected","label":"Product selected","pk":2,"id":2},{"title":"Pilot started","label":"Pilot started","pk":3,"id":3},{"title":"Technical delivery achieved","label":"Technical delivery achieved","pk":4,"id":4},{"title":"Product rolled out to users","label":"Product rolled out to users","pk":5,"id":5}],"rolesData":[{"title":"Business Sponsor","label":"Business Sponsor","pk":1,"id":1},{"title":"Project Manager","label":"Project Manager","pk":2,"id":2},{"title":"Business Analyst","label":"Business Analyst","pk":3,"id":3},{"title":"Functional Representative","label":"Functional Representative","pk":4,"id":4},{"title":"Business User","label":"Business User","pk":5,"id":5},{"title":"Subject Matter Expert","label":"Subject Matter Expert","pk":6,"id":6}],"labelsData":[],"taskTypesData":[{"pk":0,"title":"Project","level":1,"is_default_for_level":false,"icon_name":"briefcase-outline.png"},{"pk":1,"title":"Stream of work","level":1,"is_default_for_level":true,"icon_name":"briefcase-outline.png"},{"pk":2,"title":"Deliverable","level":2,"is_default_for_level":true,"icon_name":"folder-outline.png","jira_type":"Epic"},{"pk":3,"title":"Epic","level":2,"is_default_for_level":false,"icon_name":"folder-outline.png","jira_type":"Epic"},{"pk":4,"title":"Artifact","level":3,"is_default_for_level":false,"icon_name":"script-text-outline.png","jira_type":"New Feature"},{"pk":5,"title":"Task","level":3,"is_default_for_level":true,"icon_name":"card-text-outline.png","jira_type":"Task"},{"pk":6,"title":"Story","level":3,"is_default_for_level":false,"icon_name":"card-text-outline.png","jira_type":"New Feature"}],"risksData":[]}
[END] RequestId: d78285d6-c106-4220-b39c-5ed5f52b458a
[REPORT] RequestId: d78285d6-c106-4220-b39c-5ed5f52b458a
Duration: 4.13 ms
Billed Duration: 100 ms
Memory Size: 512 MB
Max Memory Used: 502 MB

Possible Fix

After all, I've looked into the output of zappa tail dev command and luckily found there full output presented so it was truncated somewhere on the way and this limit may be discovered and tweaked.

Steps to Reproduce

  1. get a Django project with JSONField and some data inside
  2. access this data via zappa invoke --raw and try to print it

Your Environment