- macOS 10.13.6
- Xcode 10.1 (10B61)
いつの間にかビルドがうまく出来なくなったので対処。
| function chainerui() { | |
| docker run \ | |
| -v $(readlink -f $1):$(readlink -f $1) \ | |
| -p ${2:-5000}:5000 \ | |
| -d \ | |
| --rm \ | |
| --name ${2:-5000} \ | |
| -it chainer/chainerui:v0.4.0 \ | |
| bash -c \ | |
| "chainerui project create -d $(readlink -f $1); |
| #!/usr/bin/env python | |
| # The MIT License (MIT) | |
| # Copyright © 2015 Recruit Technologies Co.,Ltd. | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is | |
| # furnished to do so, subject to the following conditions: |
There are a lot of Topic Models. 18/02/23 # of TM is 24
| try: | |
| import matplotlib | |
| matplotlib.use('Agg') | |
| except ImportError: | |
| pass | |
| import chainer | |
| import chainer.functions as F | |
| import chainer.links as L | |
| from chainer import training |
| # -*- coding: utf-8 -*- | |
| # Copyright (C) 2017 by Akira TAMAMORI | |
| # This program is free software; you can redistribute it and/or modify it under | |
| # the terms of the GNU General Public License as published by the Free Software | |
| # Foundation, either version 3 of the License, or (at your option) any later | |
| # version. | |
| # | |
| # This program is distributed in the hope that it will be useful, but WITHOUT |
| import sys | |
| import numpy | |
| if __name__ == '__main__': | |
| with numpy.load(sys.argv[1]) as f: | |
| print(f.keys()) |
インスタンスの起動スクリプトとかを書いてるときによく欲しいと思うやつです。
例えば、 service nginx start が実行されたあとに curl -i localhost | grep "200 OK" とかをすると、サービスがそれなりに動いていることが確認できてよかったりするのですが、あまりにも直後だとサーバの起動が間に合わず、curl が失敗してしまいます。nginxだとまだましだけど、アプリケーションサーバだとそれなりに時間がかかったりする。
古典的な解決方法は、 sleep 30 です。簡単だけど、アプリケーションが巨大になってくると30秒では起動しないこともある。じゃぁ sleep 60 が妥当か?でも、サーバインスタンスの起動スクリプト全体はできるだけ早く立ち上がってほしい。困った。
なので、curlが成功するまで叩き続ける、みたいなスクリプトに仕上げたくなるわけです。