winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.68k stars 181 forks source link

feat(sdk): add `Bucket.metadata()` for `tf-gcp` target #4633

Closed garysassano closed 5 months ago

garysassano commented 7 months ago

Closes #4332

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

monadabot commented 7 months ago

Console preview environment is available at https://wing-console-pr-4633.fly.dev :rocket:

Last Updated (UTC) 2023-12-13 01:00
monadabot commented 7 months ago

Benchmarks

Comparison to Baseline ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ | Benchmark | Before | After | Change | | :-- | --: | --: | --: | | version | 77ms±2.63 | 73ms±0.46 | -4ms (-5.24%)⬜ | | functions_10.test.w -t sim | 609ms±6.32 | 614ms±7 | +5ms (+0.82%)⬜ | | functions_10.test.w -t tf-aws | 3321ms±21.52 | 3310ms±39.39 | -11ms (-0.34%)⬜ | | functions_1.test.w -t sim | 549ms±4.02 | 548ms±4.43 | -1ms (-0.15%)⬜ | | functions_1.test.w -t tf-aws | 1535ms±34.17 | 1542ms±30.62 | +7ms (+0.46%)⬜ | | jsii_big.test.w -t sim | 3354ms±15.14 | 3349ms±16.18 | -5ms (-0.14%)⬜ | | jsii_big.test.w -t tf-aws | 3460ms±19.09 | 3456ms±5.38 | -4ms (-0.11%)⬜ | | empty.test.w -t sim | 521ms±4.43 | 518ms±5.87 | -3ms (-0.53%)⬜ | | empty.test.w -t tf-aws | 635ms±5.8 | 640ms±3.09 | +5ms (+0.78%)⬜ | | jsii_small.test.w -t sim | 520ms±4.03 | 518ms±5.37 | -2ms (-0.38%)⬜ | | jsii_small.test.w -t tf-aws | 644ms±4.37 | 641ms±4.04 | -3ms (-0.46%)⬜ | | hello_world.test.w -t sim | 546ms±7.7 | 547ms±8.06 | +2ms (+0.32%)⬜ | | hello_world.test.w -t tf-aws | 4659ms±41.88 | 4663ms±23.86 | +3ms (+0.07%)⬜ | ⬜ Within 1.5 standard deviations 🟩 Faster, Above 1.5 standard deviations 🟥 Slower, Above 1.5 standard deviations _Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI._
Results |name|mean|min|max|moe|sd| |----|----|----|----|----|----| |version|73ms|72ms|74ms|0ms|1ms| |functions_10.test.w -t sim|614ms|597ms|624ms|7ms|10ms| |functions_10.test.w -t tf-aws|3310ms|3239ms|3418ms|39ms|55ms| |functions_1.test.w -t sim|548ms|537ms|556ms|4ms|6ms| |functions_1.test.w -t tf-aws|1542ms|1460ms|1617ms|31ms|43ms| |jsii_big.test.w -t sim|3349ms|3320ms|3404ms|16ms|23ms| |jsii_big.test.w -t tf-aws|3456ms|3442ms|3471ms|5ms|8ms| |empty.test.w -t sim|518ms|506ms|530ms|6ms|8ms| |empty.test.w -t tf-aws|640ms|634ms|648ms|3ms|4ms| |jsii_small.test.w -t sim|518ms|507ms|534ms|5ms|8ms| |jsii_small.test.w -t tf-aws|641ms|631ms|648ms|4ms|6ms| |hello_world.test.w -t sim|547ms|530ms|559ms|8ms|11ms| |hello_world.test.w -t tf-aws|4663ms|4612ms|4719ms|24ms|33ms|
Last Updated (UTC) 2023-12-13 01:08
garysassano commented 7 months ago

@subh-cs Didn't test it but it should work since the code was taken straight from the docs examples.

tsuf239 commented 7 months ago

@subh-cs Didn't test it but it should work since the code was taken straight from the docs examples.

please test :)

garysassano commented 7 months ago

I've just deployed this to GCP and it works as expected.

tsuf239 commented 7 months ago

well, it seems like there is a problem with the content type...

image

for this code

bring cloud;

let b = new cloud.Bucket();

let c = new cloud.Function(inflight () => {
  b.put("file1.main.w", "Foo");
  b.put("file2.txt", "Bar");
  b.put("file3.txt", "Baz", { contentType: "application/json" });
  b.putJson("file4.txt", "Qux");

  let file1Metadata = b.metadata("file1.main.w");
  b.put("metadata.json",  "{s: ${file1Metadata.size}, c: ${file1Metadata.contentType}, lastModified: ${file1Metadata.lastModified.toIso()}}");
});

it means that it wouldn't pass the SDK metadata test... I think the best will be not to merge this PR until we get the test command, and we can be sure everything passes :) I'll review it again after having the test command working

garysassano commented 7 months ago

@tsuf239 The Bucket.metadata() method works as intended. The problem is with Bucket.put() and Bucket.putJson() not setting the right Content-Type when uploading. I will fix those later.

gcs-files

tsuf239 commented 7 months ago

I promise to review it right after adding the GCP test option

github-actions[bot] commented 6 months ago

Hi,

This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days. If you need help with the PR, do not hesitate to reach out in the winglang community slack at winglang.slack.com. Feel free to re-open this PR when it is still relevant and ready to be worked on again. Thanks!

garysassano commented 6 months ago

Keep.

github-actions[bot] commented 5 months ago

Hi,

This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days. If you need help with the PR, do not hesitate to reach out in the winglang community slack at winglang.slack.com. Feel free to re-open this PR when it is still relevant and ready to be worked on again. Thanks!

mergify[bot] commented 5 months ago

Thanks for contributing, @garysassano! This PR will now be added to the merge queue, or immediately merged if garysassano/gcs-metadata is up-to-date with main and the queue is empty.

monadabot commented 5 months ago

Congrats! :rocket: This was released in Wing 0.52.4.