modify export descriptif demarches job
This commit is contained in:
parent
058d6baae6
commit
a156529394
1 changed files with 3 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
||||||
class Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob < Cron::CronJob
|
class Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob < Cron::CronJob
|
||||||
|
include DatagouvCronSchedulableConcern
|
||||||
self.schedule_expression = "every month at 3:00"
|
self.schedule_expression = "every month at 3:00"
|
||||||
|
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
|
@ -10,13 +11,10 @@ class Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob < Cron::CronJob
|
||||||
|
|
||||||
begin
|
begin
|
||||||
DemarchesPubliquesExportService.new(gzip_filepath).call
|
DemarchesPubliquesExportService.new(gzip_filepath).call
|
||||||
APIDatagouv::API.upload(gzip_filepath)
|
io = File.new(gzip_filepath, 'r')
|
||||||
|
APIDatagouv::API.upload(io, :descriptif_demarches_dataset, :descriptif_demarches_resource)
|
||||||
ensure
|
ensure
|
||||||
FileUtils.rm(gzip_filepath)
|
FileUtils.rm(gzip_filepath)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.schedulable?
|
|
||||||
ENV.fetch('OPENDATA_ENABLED', nil) == 'enabled'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue