From dev-return-562-archive-asf-public=cust-asf.ponee.io@heron.incubator.apache.org Wed Apr 4 19:47:03 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3F86D18064F for ; Wed, 4 Apr 2018 19:47:03 +0200 (CEST) Received: (qmail 739 invoked by uid 500); 4 Apr 2018 17:47:02 -0000 Mailing-List: contact dev-help@heron.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@heron.incubator.apache.org Delivered-To: mailing list dev@heron.incubator.apache.org Received: (qmail 724 invoked by uid 99); 4 Apr 2018 17:47:02 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2018 17:47:02 +0000 From: GitBox To: dev@heron.apache.org Subject: [GitHub] ajorgensen commented on a change in pull request #2842: Add json format for dry-run Message-ID: <152286402182.32030.33661739123915798.gitbox@gitbox.apache.org> Date: Wed, 04 Apr 2018 17:47:01 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit ajorgensen commented on a change in pull request #2842: Add json format for dry-run URL: https://github.com/apache/incubator-heron/pull/2842#discussion_r179227062 ########## File path: heron/scheduler-core/src/java/com/twitter/heron/scheduler/dryrun/JsonFormatterUtils.java ########## @@ -0,0 +1,87 @@ +// Copyright 2018 Twitter. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package com.twitter.heron.scheduler.dryrun; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; + +import com.twitter.heron.spi.packing.PackingPlan; +import com.twitter.heron.spi.packing.Resource; + +public class JsonFormatterUtils { + + private final ObjectMapper mapper; Review comment: I've never used `ObjectWriter` but from what I can tell the benefit is it has a formatted output via `mapper.withDefaultPrettyPrinter()`. As i mentioned in another comment I want this output to be machine readable. If someone wants the output to be printed nicely it would be as simple as `heron submit --dry-run --dry-run-format=json ... | python -m json.tool`. Sorry I didnt make the machine readability of this output clear in the description. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services