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 travis #336

Merged
merged 3 commits into from
Mar 23, 2018
Merged
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
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,7 @@ before_install:
script:
- if [[ "$JOB" == "check_style" ]]; then ./scripts/check_style.sh; fi
- if [[ "$JOB" == "test" ]]; then ./scripts/tests.sh all; WITH_PYTHON3=ON ./scripts/tests.sh all; fi
- |
if [[ "$JOB" != "build_doc" ]]; then exit 0; fi;
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi;
if [[ "$TRAVIS_BRANCH" != "develop" ]]; then exit 0; fi;
export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/master/scripts/deploy/deploy_docs.sh
export DOCS_DIR=`pwd`
cd ..
curl $DEPLOY_DOCS_SH | bash -s $CONTENT_DEC_PASSWD $TRAVIS_BRANCH $DOCS_DIR
- if [[ "$JOB" == "build_doc" ]]; then ./scripts/deploy_docs_on_travis.sh; fi;

notifications:
email:
Expand Down
8 changes: 8 additions & 0 deletions scripts/deploy_docs_on_travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi;
if [[ "$TRAVIS_BRANCH" != "develop" ]]; then exit 0; fi;
export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/master/scripts/deploy/deploy_docs.sh
export DOCS_DIR=`pwd`
cd ..
curl $DEPLOY_DOCS_SH | bash -s $CONTENT_DEC_PASSWD $TRAVIS_BRANCH $DOCS_DIR
8 changes: 5 additions & 3 deletions visualdl/logic/im.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License. */

namespace visualdl {

const int minimun_sync_cycle = 100;
const long minimun_sync_cycle = 100;
// Expect sync happens every 15~25 seconds
const int sync_period = 20;
const int period_range = 5;
Expand Down Expand Up @@ -51,12 +51,14 @@ void SimpleWriteSyncGuard<T>::End() {
if (interval > sync_period + period_range) {
data_->parent()->meta.cycle =
std::max(long(data_->parent()->meta.cycle * faster_multiplier),
long(minimun_sync_cycle));
minimun_sync_cycle);
} else if (interval < sync_period - period_range) {
// If the last sync happens less than 15 seconds ago, the system needs to
// make the sync-up slower.
data_->parent()->meta.cycle = std::min(
long(data_->parent()->meta.cycle * slower_multiplier), LONG_MAX);
std::max(long(data_->parent()->meta.cycle * slower_multiplier),
minimun_sync_cycle),
LONG_MAX);
}
last_sync_time = current_time;
}
Expand Down
9 changes: 8 additions & 1 deletion visualdl/python/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ def test_scalar(self):
scalar.add_record(i, float(i))

print('test read')
self.writer.save()
self.reader = LogReader(self.dir)
with self.reader.mode("train") as reader:
scalar = reader.scalar("model/scalar/min")
self.assertEqual(scalar.caption(), "train")
records = scalar.records()
ids = scalar.ids()
self.assertTrue(
np.equal(records, [float(i) for i in range(10 - 1)]).all())
np.equal(records, [float(i) for i in range(10)]).all())
self.assertTrue(np.equal(ids, [float(i) for i in range(10)]).all())
print('records', records)
print('ids', ids)
Expand All @@ -50,6 +51,8 @@ def test_image(self):
image_writer.add_sample(shape, list(data))
image_writer.finish_sampling()

self.writer.save()

self.reader = LogReader(self.dir)
with self.reader.mode("train") as reader:
image_reader = reader.image(tag)
Expand Down Expand Up @@ -77,6 +80,8 @@ def test_check_image(self):
shape = [image.size[1], image.size[0], 3]
origin_data = np.array(image.getdata()).flatten()

self.writer.save()

self.reader = LogReader(self.dir)
with self.reader.mode("train") as reader:

Expand Down Expand Up @@ -104,6 +109,8 @@ def test_with_syntax(self):
for i in range(10):
scalar.add_record(i, float(i))

self.writer.save()

self.reader = LogReader(self.dir)
with self.reader.mode("train") as reader:
scalar = reader.scalar("model/scalar/average")
Expand Down