Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New lazy API for sessions #147

Open
wants to merge 25 commits into
base: v22.07.09
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e096125
Minor changes for sessions usability
calebwin Jul 14, 2022
42173a9
Implement configure_sampling, get_sampling_config, get_sample_rate, h…
calebwin Aug 3, 2022
d8ebaf2
Implement get_location_source and get_organization_id
calebwin Aug 5, 2022
fbf6481
Make changes to location constructor and PFs for BDF.jl
calebwin Aug 7, 2022
d5c11b3
Refactor RemoteTableSource into RemoteSource
calebwin Aug 7, 2022
347d1f8
Modify BanyanHDF5.jl to use new sample caching system
calebwin Aug 7, 2022
ac9d1d1
Modify BanyanImages.jl to use new sample caching system
calebwin Aug 8, 2022
08c5fbf
Implement invalidation functions, update exports, add kwargs to all r…
calebwin Aug 8, 2022
ee901a8
Implement parallel SQS data transfer and eliminate AWSSQS.jl dependency
calebwin Aug 8, 2022
8daff0a
Remove redundant total_memory_usage
calebwin Aug 9, 2022
f6bb46f
Add BanyanONNXRunTime tests for sampling
calebwin Aug 9, 2022
1a3832d
Fix some bugs and update Arrow version
calebwin Aug 9, 2022
47a4823
Fix send_to_client
calebwin Aug 10, 2022
91245c5
Fix SamplingConfig serialization
calebwin Aug 10, 2022
cbcdd7c
Fix bugs
calebwin Aug 11, 2022
dfe98d1
Add more options for updating cluster
calebwin Aug 15, 2022
52be368
Add Arrow import
calebwin Aug 16, 2022
80e2329
Fix bugs
calebwin Aug 16, 2022
734f8b7
Switch to using S3Path where possible
calebwin Aug 16, 2022
498890a
Fix new sampling system for HDF5
calebwin Aug 17, 2022
c627846
Fix new sampling system for BanyanImages
calebwin Aug 18, 2022
2ae6477
Remove print statements
calebwin Aug 18, 2022
28d5894
Make start_session create cluster if needed and change default # of w…
calebwin Aug 19, 2022
a995638
Add automatic destruction of idle clusters
calebwin Aug 19, 2022
045f2e0
Implement all changes to make starting sessions lazy
calebwin Aug 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 7 additions & 8 deletions Banyan/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ authors = ["Banyan <support@banyancomputing.com>"]
version = "0.4.1"

[deps]
AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"
AWSCore = "4f1ea46c-232b-54a6-9b17-cc2d0f3e6598"
AWSS3 = "1c724243-ef5b-51ab-93f4-b0a88ac62a95"
AWSSQS = "6e80b5ca-5733-51f9-999e-c18680912812"
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
IniFile = "83e8ac13-25f8-5344-8a64-a9f2b223428f"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
MethodAnalysis = "85b6ec6f-f7df-4429-9514-a64bcd9ee824"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
MethodAnalysis = "85b6ec6f-f7df-4429-9514-a64bcd9ee824"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand All @@ -29,15 +29,14 @@ TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"

[compat]
AWSCore = "0.6"
AWSS3 = "0.7"
AWSSQS = "0.6"
AWS = "1"
AWSS3 = "0.8"
Arrow = "2"
DataStructures = "0.18"
Downloads = "^1.4"
Downloads = "1.4"
FileIO = "1.9.1"
FilePathsBase = "^0.9.15"
HTTP = "^0.9.17"
IniFile = "0.5"
JSON = "0.21"
MPI = "^0.19.0"
MethodAnalysis = "0.4"
Expand Down
1 change: 1 addition & 0 deletions Banyan/some_file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello world
45 changes: 25 additions & 20 deletions Banyan/src/Banyan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ global NOT_USING_MODULES = String["ProfileView", "SnoopCompileCore"]
using FilePathsBase: joinpath, isempty
using Base: notnothing, env_project_file

using AWSCore,
AWSS3,
AWSSQS,
using Arrow,
Base64,
DataStructures,
Dates,
Expand All @@ -32,18 +30,27 @@ using AWSCore,
FilePathsBase,
HTTP,
JSON,
IniFile,
LibGit2,
MPI,
ProgressMeter,
Random,
Serialization,
TOML

using AWS
AWS.DEFAULT_BACKEND[] = AWS.DownloadsBackend()
s3 = set_features(AWS.AWSServices.s3; use_response_type=true)
using AWS.AWSExceptions
using AWS: @service
# TODO: Remove @service S3 since we just use AWSS3 and s3
@service S3 use_response_type = true
@service SQS use_response_type = true
using AWSS3

global BANYAN_API_ENDPOINT

# Account management
export configure
export configure, get_organization_id

# Cluster management
export Cluster,
Expand Down Expand Up @@ -82,25 +89,23 @@ export AbstractFuture, Future, partitioned_computation, compute_inplace, compute

# Samples
export Sample, ExactSample, sample, sample_for_grouping, SampleForGrouping, setsample!
export sample_memory_usage, total_memory_usage, sample_axes, sample_keys, sample_by_key
export sample_memory_usage, sample_memory_usage, sample_axes, sample_keys, sample_by_key
export NOTHING_SAMPLE
export SamplingConfig

# Locations
export Location, LocationSource, LocationDestination, located, sourced, destined
export Value, Size, Client, Disk, None
export invalidate_all_locations, invalidate_metadata, invalidate_sample
export NOTHING_LOCATION, INVALID_LOCATION
export Value, Size, Client, Disk, None, RemoteSource
export invalidate_all_locations, invalidate_location, invalidate_metadata, invalidate_samples, invalidate
export NOTHING_LOCATION, INVALID_LOCATION, NO_LOCATION_PATH
export has_separate_metadata, get_sample, get_metadata, get_sample_and_metadata
export get_remotepath_id,
get_meta_path,
get_location_path,
get_cached_location,
cache_location,
get_max_exact_sample_length,
set_max_exact_sample_length
export LocationPath, SamplingConfig
export has_metadata, has_sample, get_sample_rate, configure_sampling, get_sampling_config, get_sampling_configs, set_sampling_configs
export type_to_str, str_to_type
export banyan_metadata_bucket_name, banyan_samples_bucket_name, get_metadata_path, get_sample_path_prefix, get_sample_path

# Serialization
export from_jl_value_contents, to_jl_value_contents
export from_jl_string, to_jl_string

# Queues
export receive_from_client, send_to_client, get_sqs_dict_from_url
Expand Down Expand Up @@ -165,8 +170,8 @@ export is_debug_on,
get_partition_idx_from_divisions,
isoverlapping,
to_jl_value,
to_jl_value_contents,
from_jl_value_contents,
to_jl_string,
from_jl_string,
get_divisions,
getpath,
buftovbuf,
Expand All @@ -189,7 +194,7 @@ export is_debug_on,
export Empty, EMPTY, nonemptytype, disallowempty, empty_handler

# Utilities for location constructors
export get_cached_location, cache_location, get_sample_from_data, sample_from_range
export get_sample_from_data, sample_from_range

# Partitioning functions for usage in sessions that run on the cluster; dispatched
# based on `res/pf_dispatch_table.json`.
Expand Down
16 changes: 8 additions & 8 deletions Banyan/src/annotation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,8 @@ function apply_mutation(old::Future, new::Future)
new.mutated,
old.stale,
new.stale,
old.total_memory_usage,
new.total_memory_usage,
old.sample_memory_usage,
new.sample_memory_usage,
session_locations[old.value_id],
session_locations[new.value_id] =
new.value,
Expand All @@ -623,8 +623,8 @@ function apply_mutation(old::Future, new::Future)
old.mutated,
new.stale,
old.stale,
new.total_memory_usage,
old.total_memory_usage,
new.sample_memory_usage,
old.sample_memory_usage,
session_locations[new.value_id],
session_locations[old.value_id]
end
Expand Down Expand Up @@ -675,11 +675,11 @@ function finish_partitioned_code_region(splatted_futures::Vector{Future})

# Get the initial memory usage
for fut in splatted_futures
fut_initial_memory_usage::Int64 = if is_total_memory_usage_known(fut)
fut.total_memory_usage
fut_initial_memory_usage::Int64 = if is_sample_memory_usage_known(fut)
fut.sample_memory_usage
else
tmu::Int64 = try
get_location(fut).total_memory_usage
get_location(fut).sample_memory_usage
catch e
if e isa MethodError
error("Future with value ID $(fut.value_id) has no initial memory usage even in location with source name $(get_location(fut).src_name)")
Expand Down Expand Up @@ -877,7 +877,7 @@ function finish_partitioned_code_region(splatted_futures::Vector{Future})

# Destroy value IDs that are no longer needed because of mutation
for fut in splatted_futures
fut.total_memory_usage = task.memory_usage[fut.value_id]["final"]
fut.sample_memory_usage = task.memory_usage[fut.value_id]["final"]

# Issue destroy request for mutated futures that are no longer
# going to be used
Expand Down