質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
BigQuery

BigQueryは、Google Cloud Platformが提供しているビッグデータ解析サービス。数TB(テラバイト)またはPB(ペタバイト)の膨大なデータに対し、SQL風のクエリを実行し、高速で集計・分析を行うサービスです。

Google API

Googleは多種多様なAPIを提供していて、その多くはウェブ開発者向けのAPIです。それらのAPIは消費者に人気なGoogleのサービス(Google Maps, Google Earth, AdSense, Adwords, Google Apps,YouTube等)に基づいています。

Google App Engine

Google App Engineは、Googleの管理するデータセンター上でウェブアプリケーションの開発が可能なクラウドコンピュータ技術です。Java、Python、Go用にSDKが用意されています。

SQL

SQL(Structured Query Language)は、リレーショナルデータベース管理システム (RDBMS)のデータベース言語です。大きく分けて、データ定義言語(DDL)、データ操作言語(DML)、データ制御言語(DCL)の3つで構成されており、プログラム上でSQL文を生成して、RDBMSに命令を出し、RDBに必要なデータを格納できます。また、格納したデータを引き出すことも可能です。

Google

Googleは、アメリカ合衆国に位置する、インターネット関連のサービスや製品を提供している企業です。検索エンジンからアプリケーションの提供まで、多岐にわたるサービスを提供しています。

Q&A

解決済

1回答

588閲覧

〖再掲〗GAEのcron定義について

raccoondog

総合スコア77

BigQuery

BigQueryは、Google Cloud Platformが提供しているビッグデータ解析サービス。数TB(テラバイト)またはPB(ペタバイト)の膨大なデータに対し、SQL風のクエリを実行し、高速で集計・分析を行うサービスです。

Google API

Googleは多種多様なAPIを提供していて、その多くはウェブ開発者向けのAPIです。それらのAPIは消費者に人気なGoogleのサービス(Google Maps, Google Earth, AdSense, Adwords, Google Apps,YouTube等)に基づいています。

Google App Engine

Google App Engineは、Googleの管理するデータセンター上でウェブアプリケーションの開発が可能なクラウドコンピュータ技術です。Java、Python、Go用にSDKが用意されています。

SQL

SQL(Structured Query Language)は、リレーショナルデータベース管理システム (RDBMS)のデータベース言語です。大きく分けて、データ定義言語(DDL)、データ操作言語(DML)、データ制御言語(DCL)の3つで構成されており、プログラム上でSQL文を生成して、RDBMSに命令を出し、RDBに必要なデータを格納できます。また、格納したデータを引き出すことも可能です。

Google

Googleは、アメリカ合衆国に位置する、インターネット関連のサービスや製品を提供している企業です。検索エンジンからアプリケーションの提供まで、多岐にわたるサービスを提供しています。

0グッド

1クリップ

投稿2018/12/26 01:26

編集2018/12/27 03:17

特定のSQLをGAEのcronで定期実行させたいのですが、cron定義デプロイ時にエラーが出力されます
初回はデプロイ成功したのですが定義に不足があるため、SQLの実行は失敗
cronの定義を見直して修正と再デプロイを試みた結果、デプロイ失敗
cronの定義を元に戻してから、再デプロイをするも失敗している状況です

※デプロイ dwhtest01@cloudshell:~/cron (fluid-emissary-216806)$ gcloud app deploy cron.yaml gcloud app deploy cron.yaml ERROR: (gcloud.app.deploy) An error occurred while parsing file: [/home/dwhtest01/cron/cron.yaml] in "/home/dwhtest01/cron/cron.yaml", line 2, column 23 ※cron定義 dwhtest01@cloudshell:~/cron (fluid-emissary-216806)$ cat cron.yaml cron: -description: "test job" url: /home/dwhtest01/cron/bigquery_tbl_gousei.sql schedule: every 1 mins ※SQLの定義 dwhtest01@cloudshell:~/cron (fluid-emissary-216806)$ cat bigquery_tbl_gousei.sql insert into `fluid-emissary-216806.embulk_test.INPUT_TEST_003` (ID,NUM,STR,VARSTR,DT,TIME0,TIME6,TIME9) select * from `fluid-emissary-216806.embulk_test.INPUT_TEST_001` where Num in (select Num from `fluid-emissary-216806.embulk_test.INPUT_TEST_002` A where not exists(select 1 from `fluid-emissary-216806.embulk_test.INPUT_TEST003` B where A.NUM=B.NUM)); commit;

※2018/12/26
GAEのcloud shellからcrontablを使って、定義する方法を試しました。
実行されているか不明の状況です。

※※シスログ※※ dwhtest01@cloudshell:/var/log (fluid-emissary-216806)$ cat syslog | grep cron Dec 27 09:36:52 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 crontab[370]: (dwhtest01) BEGIN EDIT (dwhtest01) Dec 27 09:37:04 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 crontab[370]: (dwhtest01) END EDIT (dwhtest01) Dec 27 09:37:10 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 crontab[389]: (dwhtest01) BEGIN EDIT (dwhtest01) Dec 27 09:45:27 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 crontab[389]: (dwhtest01) END EDIT (dwhtest01) Dec 27 09:46:10 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 crontab[450]: (dwhtest01) LIST (dwhtest01) Dec 27 09:46:13 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 crontab[457]: (dwhtest01) BEGIN EDIT (dwhtest01) Dec 27 11:11:13 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 crontab[457]: (dwhtest01) REPLACE (dwhtest01) Dec 27 11:11:13 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 crontab[457]: (dwhtest01) END EDIT (dwhtest01) Dec 27 11:11:20 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 crontab[518]: (dwhtest01) LIST (dwhtest01) Dec 27 11:50:25 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 cron[1089]: (CRON) DEATH (can't open or create /var/run/crond.pid: Permission denied) Dec 27 11:50:35 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 cron[1134]: (CRON) INFO (pidfile fd = 3) Dec 27 11:50:35 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 cron[1135]: (CRON) STARTUP (fork ok) Dec 27 11:50:35 cs-6000-devshell-vm-b7ca3c5c-6e14-4b8f-91c9-233241f099b9 cron[1135]: (CRON) INFO (Running @reboot jobs) dwhtest01@cloudshell:/var/log (fluid-emissary-216806)$ ※※サービス状態※※ dwhtest01@cloudshell:/var/log (fluid-emissary-216806)$ service --status-all [ - ] apparmor [ + ] cgroupfs-mount [ + ] cron [ + ] docker [ ? ] hwclock.sh [ ? ] kmod [ ? ] lxc [ ? ] lxc-net [ - ] postgresql [ - ] procps [ + ] rsyslog [ + ] ssh [ - ] sudo [ - ] supervisor [ + ] udev [ - ] x11-common dwhtest01@cloudshell:/var/log (fluid-emissary-216806)$ ※※クーロン定義※※ dwhtest01@cloudshell:/var/log (fluid-emissary-216806)$ crontab -l # Edit this file to introduce tasks to be run by cron. # # Each task to run has to be defined through a single line # indicating with different fields when the task will be run # and what command to run for the task # # To define the time you can provide concrete values for # minute (m), hour (h), day of month (dom), month (mon), # and day of week (dow) or use '*' in these fields (for 'any').# # Notice that tasks will be started based on the cron's system # daemon's notion of time and timezones. # # Output of the crontab jobs (including errors) is sent through # email to the user the crontab file belongs to (unless redirected). # # For example, you can run a backup of all your user accounts # at 5 a.m every week with: # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ # # For more information see the manual pages of crontab(5) and cron(8) # # m h dom mon dow command 0 1 * * * /home/dwhtest01/cron/bigquery_tbl_gousei.sql dwhtest01@cloudshell:/var/log (fluid-emissary-216806)$

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

GAEのcron.yamlに関しては、いくつかやらなければならないことがあります。

まず、yamlはインデントなどで構文を判断します。

yaml

1cron: 2 -description: "test job" 3 url: /home/dwhtest01/cron/bigquery_tbl_gousei.sql 4 schedule: every 1 mins

このyamlファイルに関しては、
以下のように、インデントやスペースなどをcron.yamlの書き方に厳密に従ってください。

yaml

1cron: 2- description: "test job" 3 url: /home/dwhtest01/cron/bigquery_tbl_gousei.sql 4 schedule: every 1 mins

cron.yamlに関しては以下の公式ドキュメントを見ましょう。
https://cloud.google.com/appengine/docs/standard/python/config/cronref?hl=ja

また、cron.yamlで定義するurlの値はファイルパスではありません。
GAEで動かしているということは、

https://(略)~appspot.com/

というURLでアプリケーションにアクセスできるかと思いますが、
ここで指定すべきurlというのは、まさしくこのホスト名以降のパスのことです。

たとえば、

https://(略)~appspot.com/cron/query

というURLで処理を実行できるのであれば、
cron.yamlでの定義は、

yaml

1cron: 2- description: "test job" 3 url: /cron/query 4 schedule: every 1 mins

などとなります。

投稿2019/01/23 15:06

spre55

総合スコア24

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

raccoondog

2019/02/07 05:06

ご回答有難うございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問