You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by KurtYoung <gi...@git.apache.org> on 2016/08/15 01:04:20 UTC

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

GitHub user KurtYoung opened a pull request:

    https://github.com/apache/flink/pull/2370

    [FLINK-4373] [cluster management] Introduce SlotID, AllocationID, Res\u2026

    Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
    If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html).
    In addition to going through the list, please provide a meaningful description of your changes.
    
    - [ ] General
      - The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
      - The pull request addresses only one issue
      - Each commit in the PR has a meaningful commit message (including the JIRA id)
    
    - [ ] Documentation
      - Documentation has been added for new functionality
      - Old documentation affected by the pull request has been updated
      - JavaDoc for public methods has been added
    
    - [ ] Tests & Build
      - Functionality added by the pull request is covered by tests
      - `mvn clean verify` has been executed successfully locally or a Travis build has passed
    
    \u2026ourceProfile

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/alibaba/flink flink-4373

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/2370.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2370
    
----
commit 36d4a158e971f93ef26bec209c3dfac23cd0d8dc
Author: Kurt Young <yk...@gmail.com>
Date:   2016-08-12T03:05:48Z

    [FLINK-4373] [cluster management] Introduce SlotID, AllocationID, ResourceProfile

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2370#discussion_r74769608
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java ---
    @@ -0,0 +1,47 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.runtime.clusterframework.types;
    +
    +import java.io.Serializable;
    +
    +public class ResourceProfile implements Serializable {
    +
    +	private static final long serialVersionUID = -784900073893060124L;
    +
    +	/** How many cpu cores are needed, use double so we can specify cpu like 0.1 */
    +	private final double cpuCores;
    +
    +	/** How many memory in mb are needed */
    +	private final long memoryInMB;
    +
    +	public ResourceProfile(double cpuCores, long memoryInMB) {
    +		this.cpuCores = cpuCores;
    +		this.memoryInMB = memoryInMB;
    +	}
    +
    +	/**
    +	 * Check whether required resource profile can be matched
    +	 *
    +	 * @param required the required resource profile
    +	 * @return true if the requirement is matched, otherwise false
    +	 */
    +	public boolean matchRequirement(ResourceProfile required) {
    --- End diff --
    
    Maybe we could rename this method to `isMatching` or `isMatchingRequirement`. Starting these kind of methods with a question indicates that it does not change the internal state but checks for a certain condition.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by KurtYoung <gi...@git.apache.org>.
Github user KurtYoung commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2370#discussion_r74863897
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/AllocationID.java ---
    @@ -0,0 +1,38 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.runtime.clusterframework.types;
    +
    +import org.apache.flink.util.AbstractID;
    +
    +/**
    + * Unique identifier for the attempt to allocate a slot, normally created by JobManager when requesting a slot,
    + * constant across re-tries. This can also be used to identify responses by the ResourceManager and to identify
    + * deployment calls towards the TaskManager that was allocated from.
    + */
    +public class AllocationID extends AbstractID {
    +
    +	private static final long serialVersionUID = 1L;
    +
    +	/**
    +	 * Creates an new random allocation ID.
    +	 */
    +	public AllocationID() {
    +		super();
    +	}
    --- End diff --
    
    yes, you are right


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2370#discussion_r74770025
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/SlotID.java ---
    @@ -0,0 +1,81 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.runtime.clusterframework.types;
    +
    +import java.io.Serializable;
    +
    +import static org.apache.flink.util.Preconditions.checkNotNull;
    +
    +public class SlotID implements ResourceIDRetrievable, Serializable {
    +
    +	private static final long serialVersionUID = -6399206032549807771L;
    +
    +	/** The resource id which this slot located */
    +	private final ResourceID resourceId;
    +
    +	/** The numeric id for single slot */
    +	private final int slotId;
    +
    +	public SlotID(ResourceID resourceId, int slotId) {
    +		checkNotNull(resourceId, "ResourceID must not be null");
    +		this.resourceId = resourceId;
    --- End diff --
    
    You can write: `this.resourceId = checkNotNull(resourceId, "....")`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2370: [FLINK-4373] [cluster management] Introduce SlotID, Alloc...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the issue:

    https://github.com/apache/flink/pull/2370
  
    Thanks for you contribution @KurtYoung. Good work! 
    
    I only had some minor comments. Once they are addressed it's good to be merged :-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2370: [FLINK-4373] [cluster management] Introduce SlotID, Alloc...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the issue:

    https://github.com/apache/flink/pull/2370
  
    Not automatically closed by the asfgit bot. @KurtYoung could you close this PR manually?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2370#discussion_r74769869
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java ---
    @@ -0,0 +1,47 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.runtime.clusterframework.types;
    +
    +import java.io.Serializable;
    +
    +public class ResourceProfile implements Serializable {
    +
    +	private static final long serialVersionUID = -784900073893060124L;
    +
    +	/** How many cpu cores are needed, use double so we can specify cpu like 0.1 */
    +	private final double cpuCores;
    +
    +	/** How many memory in mb are needed */
    +	private final long memoryInMB;
    +
    +	public ResourceProfile(double cpuCores, long memoryInMB) {
    +		this.cpuCores = cpuCores;
    +		this.memoryInMB = memoryInMB;
    +	}
    +
    +	/**
    +	 * Check whether required resource profile can be matched
    +	 *
    +	 * @param required the required resource profile
    +	 * @return true if the requirement is matched, otherwise false
    +	 */
    +	public boolean matchRequirement(ResourceProfile required) {
    +		return Double.compare(cpuCores, required.cpuCores) >= 0 && memoryInMB >= required.memoryInMB;
    --- End diff --
    
    The same would then apply to `cpuCores` as well.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2370: [FLINK-4373] [cluster management] Introduce SlotID, Alloc...

Posted by KurtYoung <gi...@git.apache.org>.
Github user KurtYoung commented on the issue:

    https://github.com/apache/flink/pull/2370
  
    @tillrohrmann Yeah, of course. Closing it now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2370: [FLINK-4373] [cluster management] Introduce SlotID, Alloc...

Posted by KurtYoung <gi...@git.apache.org>.
Github user KurtYoung commented on the issue:

    https://github.com/apache/flink/pull/2370
  
    Hi @tillrohrmann , thanks for the reviewing, all your comments have been addressed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by KurtYoung <gi...@git.apache.org>.
Github user KurtYoung commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2370#discussion_r74864046
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java ---
    @@ -0,0 +1,47 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.runtime.clusterframework.types;
    +
    +import java.io.Serializable;
    +
    +public class ResourceProfile implements Serializable {
    +
    +	private static final long serialVersionUID = -784900073893060124L;
    +
    +	/** How many cpu cores are needed, use double so we can specify cpu like 0.1 */
    +	private final double cpuCores;
    +
    +	/** How many memory in mb are needed */
    +	private final long memoryInMB;
    --- End diff --
    
    added


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2370#discussion_r74768989
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/SlotID.java ---
    @@ -0,0 +1,81 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.runtime.clusterframework.types;
    +
    +import java.io.Serializable;
    +
    +import static org.apache.flink.util.Preconditions.checkNotNull;
    +
    +public class SlotID implements ResourceIDRetrievable, Serializable {
    --- End diff --
    
    Java docs missing


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #2370: [FLINK-4373] [cluster management] Introduce SlotID, Alloc...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on the issue:

    https://github.com/apache/flink/pull/2370
  
    Failing test cases are unrelated. Will merge this PR. Thanks for your contribution @KurtYoung.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2370#discussion_r74768392
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java ---
    @@ -0,0 +1,47 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.runtime.clusterframework.types;
    +
    +import java.io.Serializable;
    +
    +public class ResourceProfile implements Serializable {
    --- End diff --
    
    Java docs are missing


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2370#discussion_r74768700
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java ---
    @@ -0,0 +1,47 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.runtime.clusterframework.types;
    +
    +import java.io.Serializable;
    +
    +public class ResourceProfile implements Serializable {
    +
    +	private static final long serialVersionUID = -784900073893060124L;
    +
    +	/** How many cpu cores are needed, use double so we can specify cpu like 0.1 */
    +	private final double cpuCores;
    +
    +	/** How many memory in mb are needed */
    +	private final long memoryInMB;
    --- End diff --
    
    It might be helpful to have getter methods for the fields. The RM can then use the information from the ResourceProfile to create container requests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by KurtYoung <gi...@git.apache.org>.
Github user KurtYoung closed the pull request at:

    https://github.com/apache/flink/pull/2370


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2370#discussion_r74785154
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/AllocationID.java ---
    @@ -0,0 +1,38 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.runtime.clusterframework.types;
    +
    +import org.apache.flink.util.AbstractID;
    +
    +/**
    + * Unique identifier for the attempt to allocate a slot, normally created by JobManager when requesting a slot,
    + * constant across re-tries. This can also be used to identify responses by the ResourceManager and to identify
    + * deployment calls towards the TaskManager that was allocated from.
    + */
    +public class AllocationID extends AbstractID {
    +
    +	private static final long serialVersionUID = 1L;
    +
    +	/**
    +	 * Creates an new random allocation ID.
    +	 */
    +	public AllocationID() {
    +		super();
    +	}
    --- End diff --
    
    This constructor is the standard default constructor, right? I guess we don't need to specify this constructor then.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #2370: [FLINK-4373] [cluster management] Introduce SlotID...

Posted by tillrohrmann <gi...@git.apache.org>.
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2370#discussion_r74769810
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java ---
    @@ -0,0 +1,47 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 org.apache.flink.runtime.clusterframework.types;
    +
    +import java.io.Serializable;
    +
    +public class ResourceProfile implements Serializable {
    +
    +	private static final long serialVersionUID = -784900073893060124L;
    +
    +	/** How many cpu cores are needed, use double so we can specify cpu like 0.1 */
    +	private final double cpuCores;
    +
    +	/** How many memory in mb are needed */
    +	private final long memoryInMB;
    +
    +	public ResourceProfile(double cpuCores, long memoryInMB) {
    +		this.cpuCores = cpuCores;
    +		this.memoryInMB = memoryInMB;
    +	}
    +
    +	/**
    +	 * Check whether required resource profile can be matched
    +	 *
    +	 * @param required the required resource profile
    +	 * @return true if the requirement is matched, otherwise false
    +	 */
    +	public boolean matchRequirement(ResourceProfile required) {
    +		return Double.compare(cpuCores, required.cpuCores) >= 0 && memoryInMB >= required.memoryInMB;
    --- End diff --
    
    Maybe we could create a getter method for `memoryInMB`. Then we don't have to access the private fields of another instance.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---