Skip to content

Commit

Permalink
Miscellaneous Changes/Fixes (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danidite authored Sep 26, 2024
1 parent e5f60a7 commit 2fe73de
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions QUICK_START.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ poetry run caribou deploy_remote_cli
```

You may also specify the `memory` (in MB), `timeout` (in seconds), and `ephemeral_storage` (in MB) using the following flags:
- `memory`: Use `--memory` or `-m`. Default: 5,120 MB
- `memory`: Use `--memory` or `-m`. Default: 1,769 MB (1 Full vCPU)
- `timeout`: Use `--timeout` or `-t`. Default: 900 seconds
- `ephemeral_storage`: Use `--ephemeral_storage` or `-s`. Default: 10,240 MB
- `ephemeral_storage`: Use `--ephemeral_storage` or `-s`. Default: 5,120 MB

To remove the remote framework, use the following command:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type SimpleDeploymentMetricsCalculator struct {
func SetupSimpleDeploymentMetricsCalculator(dataString string) *SimpleDeploymentMetricsCalculator {
return &SimpleDeploymentMetricsCalculator{
*SetupDeploymentMetricsCalculator(dataString),
1000,
200,
}
}

Expand Down Expand Up @@ -144,7 +144,7 @@ func (sd *SimpleDeploymentMetricsCalculator) PerformMonteCarloSimulation(deploym
executionCarbonList := []float64{}
transmissionCarbonList := []float64{}

maxNumberOfIterations := 20000
maxNumberOfIterations := 2000
threshold := 0.05
numberOfIterations := 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ func TestSimpleDeploymentMetricsCalculator_PerformMonteCarloSimulation(t *testin
assert.Equal(t, result["tail_cost"], 1.0)
assert.Equal(t, result["tail_runtime"], 1.0)
assert.Equal(t, result["tail_carbon"], 1.0)
assert.Equal(t, callCounter, 20000)
assert.Equal(t, callCounter, 2000)
}
4 changes: 2 additions & 2 deletions caribou/deployment/client/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def deploy_remote_cli(
)

## Memory
memory_mb: int = 5120 # 5 GB (Not the maximum)
memory_mb: int = 1769 # 1 full vCPU (https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html)
if memory is not None:
# Convert to int
memory_mb = int(memory)
Expand All @@ -178,7 +178,7 @@ def deploy_remote_cli(
raise click.ClickException("Timeout must be between 1 second and 900 seconds (15 minutes).")

## Ephemeral Storage
ephemeral_storage_mb = 10240 # Maximum ephemeral storage (10 GB)
ephemeral_storage_mb = 5120 # 5 GB (Should be enough for most use cases)
if ephemeral_storage is not None:
# Convert to int
ephemeral_storage_mb = int(ephemeral_storage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(
record_transmission_execution_carbon,
)
self.n_processes = n_processes
self.batch_size = 1000
self.batch_size = 200
if n_processes > 1:
self._setup(
workflow_config,
Expand Down Expand Up @@ -190,7 +190,7 @@ def _perform_monte_carlo_simulation(self, deployment: list[int]) -> dict[str, fl
execution_carbon_list: list[float] = []
transmission_carbon_list: list[float] = []

max_number_of_iterations = 20000
max_number_of_iterations = 2000
threshold = 0.05
number_of_iterations = 0
while number_of_iterations < max_number_of_iterations:
Expand Down
11 changes: 8 additions & 3 deletions caribou/syncers/components/execution_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,16 @@ def _get_total_output_data_size(self) -> float:

return total_output_data_size

def _get_total_input_data_size(self) -> float:
def _get_total_input_data_size(self, consider_input_payload: bool = False) -> float:
total_input_data_size = 0.0

if self.input_payload_size:
total_input_data_size += self.input_payload_size
# It appears that the input payload size is not captured
# in the lambda insights, so we will not include it in the
# total input data size calculation, if it is not explicitly
# requested.
if consider_input_payload:
if self.input_payload_size:
total_input_data_size += self.input_payload_size

if self.download_size:
total_input_data_size += self.download_size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_perform_monte_carlo_simulation(self, mock_calculate_workflow):
self.assertEqual(results["tail_carbon"], 1.0)

# Verify that the mock method was called the correct number of times with the correct arguments
self.assertEqual(mock_calculate_workflow.call_count, 20000)
self.assertEqual(mock_calculate_workflow.call_count, 2000)
mock_calculate_workflow.assert_called_with(deployment)

@patch.object(
Expand Down
9 changes: 5 additions & 4 deletions caribou/tests/syncers/components/test_execution_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ def test_get_total_output_data_size(self):
self.assertEqual(self.execution_data._get_total_output_data_size(), 10.0)

def test_get_total_input_data_size(self):
# Not part of total input data size unless explicitly specified
self.execution_data.input_payload_size = 1.0
self.execution_data.download_size = 2.0
successor_data = Mock(spec=ExecutionToSuccessorData)
successor_data.get_total_input_data_size.return_value = 3.0
self.execution_data.successor_data["successor1"] = successor_data
self.assertEqual(self.execution_data._get_total_input_data_size(), 6.0)
self.assertEqual(self.execution_data._get_total_input_data_size(), 5.0)

def test_data_transfer_during_execution(self):
self.execution_data.lambda_insights = {"total_network": 10 * 1024**3} # 10 GB
Expand All @@ -52,7 +53,7 @@ def test_data_transfer_during_execution(self):
successor_data.get_total_input_data_size.return_value = 3.0
successor_data.get_total_output_data_size.return_value = 4.0
self.execution_data.successor_data["successor1"] = successor_data
self.assertEqual(self.execution_data.data_transfer_during_execution, 10 - 6 - 4)
self.assertEqual(self.execution_data.data_transfer_during_execution, 10 - 5 - 4)

def test_longest_duration(self):
self.execution_data.user_execution_duration = 1.0
Expand Down Expand Up @@ -101,13 +102,13 @@ def test_to_dict(self):
"duration_s": 3.0,
"cpu_model": "test_cpu",
"provider_region": "us-west-2",
"data_transfer_during_execution_gb": 10 - 6 - 4,
"data_transfer_during_execution_gb": 10 - 5 - 4,
"cpu_utilization": 1.0,
"successor_data": {"successor1": {"key": "value"}},
"additional_analysis_data": {
"input_payload_size_gb": 1.0,
"download_size_gb": 2.0,
"total_input_data_transfer_gb": 6.0,
"total_input_data_transfer_gb": 5.0,
"total_output_data_transfer_gb": 4.0,
},
}
Expand Down

0 comments on commit 2fe73de

Please sign in to comment.