Inhalte aufrufen

Profilbild

Start Import Cron Job remote


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
9 Antworten zu diesem Thema

#1 TripleNico

TripleNico

    Advanced Member

  • Members
  • 51 Beiträge

Geschrieben: 30 January 2020 - 15:41

When logged in as Admin you can start a Import cron job by simply calling GET /admin/scheduletask/runjob/{IDJOB}. Is there a way to execute this command externally, for example we want to only run the cron job when we have changed the data in the Import CSV file. Else it would run the import job every minute which doesn't  sounds very efficient instead we would like to trigger it like an event. So new data in CSV -->> run Import cron job.



#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3503 Beiträge

Geschrieben: 30 January 2020 - 19:05

No. That would cause security problems. You can change the execution interval of each job by Cron expression or start a job by code through ITaskScheduler.RunSingleTask in combination of a ImportExecutedEvent handler.


Schöne Grüße aus Düsseldorf,
Marcus Gesing


#3 TripleNico

TripleNico

    Advanced Member

  • Members
  • 51 Beiträge

Geschrieben: 31 January 2020 - 16:11

That's what I thought ;-) Is it possible otherwise via the WebApi? Will want to trigger the action itself when a change has taken place.



#4 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3503 Beiträge

Geschrieben: 31 January 2020 - 18:53

No, only by code.


Schöne Grüße aus Düsseldorf,
Marcus Gesing


#5 TripleNico

TripleNico

    Advanced Member

  • Members
  • 51 Beiträge

Geschrieben: 17 February 2020 - 16:00

If i use the /Uploads/ImportFiles endpoint as described here: https://docs.smartst... to Data Import to upload Import CSV data would that automatically trigger the import function? I do hope so because then i won't have to schedule a cron job to look every minute for changes.

 

Side note: Is it possible to disable the email you get with the import result? If i set a cron job for a import profile to run every minute i get a lot of emails….



#6 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3503 Beiträge

Geschrieben: 17 February 2020 - 17:38

No. It just allows to upload import files for a given import profile but it doesn't trigger the import.
The import executed mail is always sent. You have to start the import yourself by code if you do not want to leave the control to the import profile.

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#7 TripleNico

TripleNico

    Advanced Member

  • Members
  • 51 Beiträge

Geschrieben: 18 February 2020 - 08:20

Would it be possible to add a property to the /Uploads/ImportFiles like "ExecuteImportOnUpload" ? telling the endpoint that after an upload was succesfull an import has to be started?



#8 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3503 Beiträge

Geschrieben: 18 February 2020 - 15:54

Yes, I've created an issue for it.


Schöne Grüße aus Düsseldorf,
Marcus Gesing


#9 TripleNico

TripleNico

    Advanced Member

  • Members
  • 51 Beiträge

Geschrieben: 21 February 2020 - 17:44

Thats great! Do you have an estimation when this would be implemented?



#10 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3503 Beiträge

Geschrieben: 21 February 2020 - 19:59

It's already implemented as you can see in the issue.


Schöne Grüße aus Düsseldorf,
Marcus Gesing