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

Fix flushing and avoid upload caching #519

Merged
merged 7 commits into from
Oct 26, 2021
Merged

Fix flushing and avoid upload caching #519

merged 7 commits into from
Oct 26, 2021

Conversation

csegarragonz
Copy link
Collaborator

Closes #518

@csegarragonz csegarragonz self-assigned this Oct 22, 2021
boost::filesystem::remove(expectedHashFile);

// Check putting the file
std::string fileKey = "gamma/delta/function.wasm";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactor the upload test to use the S3 API rather than directly access the underlying filesystem.

@csegarragonz csegarragonz force-pushed the more-flushing branch 2 times, most recently from fe911e9 to 60b9f91 Compare October 22, 2021 20:09
@csegarragonz csegarragonz marked this pull request as ready for review October 22, 2021 20:10
@csegarragonz csegarragonz force-pushed the more-flushing branch 11 times, most recently from 36f7eed to c109591 Compare October 25, 2021 10:21
- name: "Flush workers"
run: docker-compose run -T cpp inv func.flush --host=nginx
- name: "Build echo function"
run: docker-compose run -T cpp bash -c "inv func demo echo && /usr/bin/cp /code/cpp/build/func/demo/echo.wasm /code/cpp/build/func/demo/hello.wasm && inv func.upload demo hello"
Copy link
Collaborator Author

@csegarragonz csegarragonz Oct 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no nice way to split this into multiple lines without breaking the command. Given that we already break the line limit in other places in this file I have left it like this.

Possible alternatives are:

  • Move to a python script/task.
  • Try and do some bash hacks like suggested here.
  • Add an option to func.upload to accept a different file path. This wouldn't make the command much shorter but maybe a bit.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general when there's this much CI-specific logic it's best to put it into a bash script somewhere, e.g. bin/run_quick_start_checks.sh. This has two advantages: (i) avoids gnarly syntax like this; (ii) can be run locally to debug issues.

- name: "Flush workers"
run: docker-compose run -T cpp inv func.flush --host=nginx
- name: "Build echo function"
run: docker-compose run -T cpp bash -c "inv func demo echo && /usr/bin/cp /code/cpp/build/func/demo/echo.wasm /code/cpp/build/func/demo/hello.wasm && inv func.upload demo hello"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general when there's this much CI-specific logic it's best to put it into a bash script somewhere, e.g. bin/run_quick_start_checks.sh. This has two advantages: (i) avoids gnarly syntax like this; (ii) can be run locally to debug issues.

{
static thread_local FileLoader fl;
static thread_local FileLoader fl(useLocalFsCache);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this works in our current use-case, I think this can happen:

// This works, I get a FileLoader with useLocalCache == true
FileLoader &fl = getFileLoader(true):

// Here I get a ref to the same static object, so even though I requested
// useLocalFsCache == false, I get one with true
FileLoader &otherFl = getFileLoader(false):

Instead we could have two methods:

// Normal one using FS cache
FileLoader &getFileLoader();

// Cache-less version
FileLoader &getFileLoaderWithoutLocalCache();

The other option is to add a new subclass called FileLoaderNoCache, which makes it more explicit and perhaps more obvious to users which one they're using. However, in this case I think just having two methods makes sense.

UploadTestFixture() {}
~UploadTestFixture() {}
UploadTestFixture() { faabric::util::setTestMode(false); }
~UploadTestFixture() { faabric::util::setTestMode(true); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to turn off test mode here? It's risky as it can mess up the local environment and cause quite hard to debug issues. Can we be more targeted in what we're switching on/ off?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, this was not needed in the end.

@csegarragonz csegarragonz merged commit a9de10a into master Oct 26, 2021
@csegarragonz csegarragonz deleted the more-flushing branch October 26, 2021 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix flushing and avoid upload caching
2 participants