Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C9855200D43 for ; Mon, 6 Nov 2017 16:04:08 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C7D14160BEC; Mon, 6 Nov 2017 15:04:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 257511609E0 for ; Mon, 6 Nov 2017 16:04:07 +0100 (CET) Received: (qmail 67070 invoked by uid 500); 6 Nov 2017 15:04:07 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 67020 invoked by uid 99); 6 Nov 2017 15:04:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Nov 2017 15:04:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 40FBE10E029 for ; Mon, 6 Nov 2017 15:04:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id U5xZzLeDQq0p for ; Mon, 6 Nov 2017 15:04:04 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 64F135FD38 for ; Mon, 6 Nov 2017 15:04:04 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id EC52AE095C for ; Mon, 6 Nov 2017 15:04:03 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id B14B4241C0 for ; Mon, 6 Nov 2017 15:04:00 +0000 (UTC) Date: Mon, 6 Nov 2017 15:04:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-7878) Extend the resource type user can define in ResourceSpec MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 06 Nov 2017 15:04:09 -0000 [ https://issues.apache.org/jira/browse/FLINK-7878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16240413#comment-16240413 ] ASF GitHub Bot commented on FLINK-7878: --------------------------------------- Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/4911#discussion_r149096221 --- Diff: flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java --- @@ -183,17 +238,81 @@ public int hashCode() { result = 31 * result + directMemoryInMB; result = 31 * result + nativeMemoryInMB; result = 31 * result + stateSizeInMB; + result = 31 * result + extendedResources.hashCode(); return result; } @Override public String toString() { + String extend = ""; + for (Resource resource : extendedResources.values()) { + extend += ", " + resource.name + "=" + resource.value; + } return "ResourceSpec{" + "cpuCores=" + cpuCores + ", heapMemoryInMB=" + heapMemoryInMB + ", directMemoryInMB=" + directMemoryInMB + ", nativeMemoryInMB=" + nativeMemoryInMB + - ", stateSizeInMB=" + stateSizeInMB + + ", stateSizeInMB=" + stateSizeInMB + extend + '}'; } + + private void addResource(String name, double value, ResourceAggregateType type) { + extendedResources.put(name, new Resource(name, type, value)); + } + + public static class Resource { + private String name; + private ResourceAggregateType type; + private Double value; + + public Resource(String name, double value) { + this(name, ResourceAggregateType.AGGREGATE_TYPE_SUM, value); + } + + public Resource(String name, ResourceAggregateType type, double value) { + this.name = name; + this.type = type; --- End diff -- `checkNotNull` missing > Extend the resource type user can define in ResourceSpec > -------------------------------------------------------- > > Key: FLINK-7878 > URL: https://issues.apache.org/jira/browse/FLINK-7878 > Project: Flink > Issue Type: Improvement > Components: DataSet API, DataStream API > Reporter: shuai.xu > Assignee: shuai.xu > Labels: flip-6 > > Now, flink only support user define how much CPU and MEM used in an operator, but now the resource in a cluster is various. For example, an application for image processing may need GPU, some others may need FPGA. > Only CPU and MEM is not enough, and the resource type is becoming more and more, so we need to make the ResourSpec extendible. -- This message was sent by Atlassian JIRA (v6.4.14#64029)