Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions python/ray/autoscaler/aws/node_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,28 @@
from botocore.config import Config

from ray.autoscaler.node_provider import NodeProvider
from ray.autoscaler.tags import TAG_RAY_CLUSTER_NAME
from ray.autoscaler.tags import TAG_RAY_CLUSTER_NAME, TAG_RAY_NODE_NAME
from ray.ray_constants import BOTO_MAX_RETRIES


def to_aws_format(tags):
"""Convert the Ray node name tag to the AWS-specific 'Name' tag."""

if TAG_RAY_NODE_NAME in tags:
tags["Name"] = tags[TAG_RAY_NODE_NAME]
del tags[TAG_RAY_NODE_NAME]
return tags


def from_aws_format(tags):
"""Convert the AWS-specific 'Name' tag to the Ray node name tag."""

if "Name" in tags:
tags[TAG_RAY_NODE_NAME] = tags["Name"]
del tags["Name"]
return tags


class AWSNodeProvider(NodeProvider):
def __init__(self, provider_config, cluster_name):
NodeProvider.__init__(self, provider_config, cluster_name)
Expand All @@ -26,6 +44,7 @@ def __init__(self, provider_config, cluster_name):
self.external_ip_cache = {}

def nodes(self, tag_filters):
tag_filters = to_aws_format(tag_filters)
filters = [
{
"Name": "instance-state-name",
Expand Down Expand Up @@ -59,7 +78,7 @@ def node_tags(self, node_id):
tags = {}
for tag in node.tags:
tags[tag["Key"]] = tag["Value"]
return tags
return from_aws_format(tags)

def external_ip(self, node_id):
if node_id in self.external_ip_cache:
Expand All @@ -80,6 +99,7 @@ def internal_ip(self, node_id):
return ip

def set_node_tags(self, node_id, tags):
tags = to_aws_format(tags)
node = self._node(node_id)
tag_pairs = []
for k, v in tags.items():
Expand All @@ -90,6 +110,7 @@ def set_node_tags(self, node_id, tags):
node.create_tags(Tags=tag_pairs)

def create_node(self, node_config, tags, count):
tags = to_aws_format(tags)
conf = node_config.copy()
tag_pairs = [{
"Key": TAG_RAY_CLUSTER_NAME,
Expand Down
5 changes: 2 additions & 3 deletions python/ray/dataframe/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -4926,9 +4926,8 @@ def __array__(self, dtype=None):
return to_pandas(self).__array__(dtype=dtype)

def __array_wrap__(self, result, context=None):
raise NotImplementedError(
"To contribute to Pandas on Ray, please visit "
"github.com/ray-project/ray.")
# TODO: This is very inefficient, see also __array__ and as_matrix
return to_pandas(self).__array_wrap__(result, context=context)

def __getstate__(self):
raise NotImplementedError(
Expand Down
7 changes: 0 additions & 7 deletions python/ray/dataframe/test/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3191,13 +3191,6 @@ def test___array__(ray_df, pandas_df):
assert np.array_equal(ray_df.__array__(), pandas_df.__array__())


def test___array_wrap__():
ray_df = create_test_dataframe()

with pytest.raises(NotImplementedError):
ray_df.__array_wrap__(None)


def test___getstate__():
ray_df = create_test_dataframe()

Expand Down
2 changes: 1 addition & 1 deletion python/ray/rllib/utils/tf_policy_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def apply_gradients(self, gradients):
feed_dict[self._is_training] = True
for ph, value in zip(self._grads, gradients):
feed_dict[ph] = value
fetches = self.sess.run(
fetches = self._sess.run(
[self._apply_op, self.extra_apply_grad_fetches()],
feed_dict=feed_dict)
return fetches[1]
Expand Down
11 changes: 9 additions & 2 deletions thirdparty/scripts/build_arrow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ else
fi

# Download and compile arrow if it isn't already present.
if [[ ! -d $TP_DIR/../python/ray/pyarrow_files/pyarrow ]]; then
if [[ ! -d $TP_DIR/../python/ray/pyarrow_files/pyarrow || \
"$LANGUAGE" == "java" && ! -f $TP_DIR/../build/src/plasma/libplasma_java.dylib ]]; then
echo "building arrow"

if [[ "$LANGUAGE" == "java" && ! -f $TP_DIR/../build/src/plasma/libplasma_java.dylib ]]; then
rm -rf $TP_DIR/build/arrow
rm -rf $TP_DIR/build/parquet-cpp
rm -rf $TP_DIR/pkg/arrow
fi

if [[ ! -d $TP_DIR/build/arrow ]]; then
git clone https://github.com/apache/arrow.git "$TP_DIR/build/arrow"
fi
Expand All @@ -53,7 +60,7 @@ if [[ ! -d $TP_DIR/../python/ray/pyarrow_files/pyarrow ]]; then
# The PR for this commit is https://github.com/apache/arrow/pull/2065. We
# include the link here to make it easier to find the right commit because
# Arrow often rewrites git history and invalidates certain commits.
git checkout ce23c06469de9cf0c3e38e35cdb8d135f341b964
git checkout 34890cc133d6761bdedc53e0b88374ccd7641c55

cd cpp
if [ ! -d "build" ]; then
Expand Down