たまに掃除は必要!熱暴走…

イメージ
 そんなに暑くないのに… 本日、午前中にオンラインで打合せをしていると、突然マシンがダウン。 一瞬、停電か?と思ったもののディスプレイの電源は入っている。 あれっ?と思い、すぐさまノートで打合せを継続。 その間に、再度マシンの電源を投入。 問題なく起動する。 でも、CPU温度がたまたま目に入り、95℃を超えて徐々に上昇していく。 105℃あたりで再度マシンダウン。 これは、熱暴走によるダウンの可能性が高い。 以前、CPUをRyzen7→9にした頃は、60℃〜70℃程度だった記憶がある。 本当はGW中にSSDの載せ替えを行う予定だったけれど、忙しくて先延ばしにしていた。 その時やっていれば、多分掃除もしただろうに…。 ということで、午後からマシンを解体し、掃除をすることに。 ケース本体のFANはホコリがかなり溜まっている。 GPUのFANは問題ない。 電源とCPU FANはひどい。 一旦、CPU FANを取り外し、きれいにする。ついでにCPUグリスも塗り直しセット。 動作確認すると、投入直後で40℃台。 そりゃ、熱暴走も起こすわけだ。 せっかくバラしたので、SSDの載せ替えを実施。 OSは500GBで、ユーザ領域(/home)は1TBを使用しているもののAIのmodelをいくつも落としていたり、DockerのImageが多種置いてあるため、結構容量を食っている。 今回、2TBのSSD( Hanye SSD ¥17,800- で入手済)を用意してあるので、 1TB→2TB, 500GB→1TBと玉突きで移動させることを計画していたので実施する。 本当は、ddコマンドで移すつもりだったのだけれど、3月にお客さんのところで使いそうだったので、 ORICOのクローン機能付SSDアダプタ を入手済。 裸族のSSD版ですね…。1万円程度の品です。 これに、新品のSSDとこれまでの1TBのSSDを差し込んでクローン開始。 そこそこ時間はかかるものの、放置でOK。 ただ、HanyeのSSDについているヒートシンクが引っかかるため、一旦取り外してクローン後取り付ける必要があった。 続いて、500GB→先程の1TBに書き込み。 ただ、1TB(samsungの980pro)が、先程のクローンでかなり熱くなっていたため、速度低下が激しい感じ。1TB→2TBよりも時間がかかった感じ。 ...

csvqのbuild

使おうと思ったら、無かった…

以前あまりに便利だったので、buildして使っていた「csvq」だけど、マシンを入れ替えた際に入れ忘れていたらしい…。

前にbuildした時は、さっくりと動作したので、最新バージョンを持ってきてbuildすればいいやぁと思って作業してみると、エラーを吐きまくる。
バイナリ持ってきてきても良いけど、時間がある今なので、頑張ってみることにした。


Installation

Install executable binary
Download an archive file from release page.
Extract the downloaded archive and add a binary file in it to your path.
Build from source
Requirements

Go 1.11 or later (ref. Getting Started - The Go Programming Language)
Build with one of the following ways
Use go get
$ go get github.com/mithrandie/csvq
Build with strict dependencies
$ go get -d github.com/mithrandie/csvq
Change directory to $GOPATH/src/github.com/mithrandie/csvq
$ env GO111MODULE=on go install




githubに書かれているとおりに、

$ go get github.com/mithrandie/csvq



すると、以下のようなエラーが大量に…。

$ go get github.com/mithrandie/csvq

# github.com/mithrandie/csvq

../../go/src/github.com/mithrandie/csvq/main.go:35:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:39:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:44:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:48:15: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in slice literal:
cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:52:18: cannot use cli.Float64Flag literal (type cli.Float64Flag) as type cli.Flag in slice literal:
cli.Float64Flag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:57:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:61:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:66:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:71:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:75:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
../../go/src/github.com/mithrandie/csvq/main.go:75:17: too many errors


しかも、最後の行を見るとtoo many errorsとか言ってくるし…。


さて、このErrorの理由をググってみると、

こんな情報をゲット。


良くわからないが、該当する行を全て書き換えてみる。

main.goのAppFlag内のcli.〜に該当する部分を全て&を先頭に付加。

保存して、buildしてみる。


$ make

GOPATH=/home/yoshimura/go/src/github.com/mithrandie/csvq/build go build -ldflags="-X github.com/mithrandie/csvq/lib/query.Version=v1.13.3-3-g119a62d" -o /home/yoshimura/go/src/github.com/mithrandie/csvq/build/bin/csvq
go: downloading github.com/urfave/cli v1.20.0
go: downloading github.com/mithrandie/ternary v1.1.0
go: downloading github.com/mithrandie/go-text v1.3.1
go: downloading github.com/mitchellh/go-homedir v1.0.0
go: downloading github.com/mithrandie/go-file/v2 v2.0.2
go: downloading golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869
go: downloading github.com/mithrandie/readline-csvq v1.1.1
go: downloading golang.org/x/text v0.3.1
go: downloading golang.org/x/sys v0.0.0-20191029155521-f43be2a4598c


おっ!無事に通った。

build/bin/ を確認すると、csvqが出来上がっている。


念の為、バージョンを確認。

$ ./csvq -v

csvq version v1.13.3-3-g119a62d

ちゃんと、出来上がっているようだ。


helpもInteractiveモードも動作する。


試しに、test.csvを作成し、SQLを叩いてみる。
https://qiita.com/mithrandie/items/146564e748ee235709c0


$ ./csvq
> select * from `test.csv`
+----+------------------+-----------+
| id |       name       | parent_id |
+----+------------------+-----------+
| 1  | ラダトーム       |   NULL    |
| 2  | りゅうおうのしろ |   NULL    |
| 3  | ガライ           | 1         |
| 4  | マイラ           | 1         |
| 5  | リムルダール     | 1         |
| 6  | ドムドーラ       | 1         |
| 7  | メルキド         | 1         |
| 8  | あめのほこら     | 4         |
| 9  | せいなるほこら   | 5         |
+----+------------------+-----------+


問題はなさそう…。

ということで、こいつは~/binに格納しておく。


ただ、ダウンロードしたバイナリと比較してみると微妙にサイズが異なるので、少々心配だけど、動けばOKなので、良しとする。

ちなみに、
csvq-v1.13.1-linux-amd64.tar.gz 内のcsvqは、15,672,673 バイト
自分でbuildしたものは14,517,598バイトなのは、何故かなぁ〜?

ダウンロードしたバイナリのバージョンは、1.13.1とsrcの方が若干新しいのかもしれないと言うことにしておこう。



コメント

このブログの人気の投稿

Ubuntu24.04 でGUIが死んだ

VirtualBoxが異常

MEGAにも弱点があった?