未验证 提交 aa56f336 编写于 作者: J Jeff Wang 提交者: GitHub

Fix travis (#336)

* Fix the incorrect test cases

* Move the doc related commands to a script.

* Add X to the deploy_docs_on_travis.sh permission
上级 d7580a3f
...@@ -53,14 +53,7 @@ before_install: ...@@ -53,14 +53,7 @@ before_install:
script: script:
- if [[ "$JOB" == "check_style" ]]; then ./scripts/check_style.sh; fi - 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" == "test" ]]; then ./scripts/tests.sh all; WITH_PYTHON3=ON ./scripts/tests.sh all; fi
- | - if [[ "$JOB" == "build_doc" ]]; then ./scripts/deploy_docs_on_travis.sh; 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
notifications: notifications:
email: email:
......
#!/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
...@@ -22,7 +22,7 @@ limitations under the License. */ ...@@ -22,7 +22,7 @@ limitations under the License. */
namespace visualdl { namespace visualdl {
const int minimun_sync_cycle = 100; const long minimun_sync_cycle = 100;
// Expect sync happens every 15~25 seconds // Expect sync happens every 15~25 seconds
const int sync_period = 20; const int sync_period = 20;
const int period_range = 5; const int period_range = 5;
...@@ -51,12 +51,14 @@ void SimpleWriteSyncGuard<T>::End() { ...@@ -51,12 +51,14 @@ void SimpleWriteSyncGuard<T>::End() {
if (interval > sync_period + period_range) { if (interval > sync_period + period_range) {
data_->parent()->meta.cycle = data_->parent()->meta.cycle =
std::max(long(data_->parent()->meta.cycle * faster_multiplier), std::max(long(data_->parent()->meta.cycle * faster_multiplier),
long(minimun_sync_cycle)); minimun_sync_cycle);
} else if (interval < sync_period - period_range) { } else if (interval < sync_period - period_range) {
// If the last sync happens less than 15 seconds ago, the system needs to // If the last sync happens less than 15 seconds ago, the system needs to
// make the sync-up slower. // make the sync-up slower.
data_->parent()->meta.cycle = std::min( 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; last_sync_time = current_time;
} }
......
...@@ -23,6 +23,7 @@ class StorageTest(unittest.TestCase): ...@@ -23,6 +23,7 @@ class StorageTest(unittest.TestCase):
scalar.add_record(i, float(i)) scalar.add_record(i, float(i))
print('test read') print('test read')
self.writer.save()
self.reader = LogReader(self.dir) self.reader = LogReader(self.dir)
with self.reader.mode("train") as reader: with self.reader.mode("train") as reader:
scalar = reader.scalar("model/scalar/min") scalar = reader.scalar("model/scalar/min")
...@@ -30,7 +31,7 @@ class StorageTest(unittest.TestCase): ...@@ -30,7 +31,7 @@ class StorageTest(unittest.TestCase):
records = scalar.records() records = scalar.records()
ids = scalar.ids() ids = scalar.ids()
self.assertTrue( 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()) self.assertTrue(np.equal(ids, [float(i) for i in range(10)]).all())
print('records', records) print('records', records)
print('ids', ids) print('ids', ids)
...@@ -50,6 +51,8 @@ class StorageTest(unittest.TestCase): ...@@ -50,6 +51,8 @@ class StorageTest(unittest.TestCase):
image_writer.add_sample(shape, list(data)) image_writer.add_sample(shape, list(data))
image_writer.finish_sampling() image_writer.finish_sampling()
self.writer.save()
self.reader = LogReader(self.dir) self.reader = LogReader(self.dir)
with self.reader.mode("train") as reader: with self.reader.mode("train") as reader:
image_reader = reader.image(tag) image_reader = reader.image(tag)
...@@ -77,6 +80,8 @@ class StorageTest(unittest.TestCase): ...@@ -77,6 +80,8 @@ class StorageTest(unittest.TestCase):
shape = [image.size[1], image.size[0], 3] shape = [image.size[1], image.size[0], 3]
origin_data = np.array(image.getdata()).flatten() origin_data = np.array(image.getdata()).flatten()
self.writer.save()
self.reader = LogReader(self.dir) self.reader = LogReader(self.dir)
with self.reader.mode("train") as reader: with self.reader.mode("train") as reader:
...@@ -104,6 +109,8 @@ class StorageTest(unittest.TestCase): ...@@ -104,6 +109,8 @@ class StorageTest(unittest.TestCase):
for i in range(10): for i in range(10):
scalar.add_record(i, float(i)) scalar.add_record(i, float(i))
self.writer.save()
self.reader = LogReader(self.dir) self.reader = LogReader(self.dir)
with self.reader.mode("train") as reader: with self.reader.mode("train") as reader:
scalar = reader.scalar("model/scalar/average") scalar = reader.scalar("model/scalar/average")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册