Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Commands like delete, deactivate, activate #14

Open
2 of 4 tasks
mbo-s opened this issue Sep 25, 2018 · 6 comments
Open
2 of 4 tasks

Missing Commands like delete, deactivate, activate #14

mbo-s opened this issue Sep 25, 2018 · 6 comments
Assignees
Labels
enhancement Create new functionality

Comments

@mbo-s
Copy link

mbo-s commented Sep 25, 2018

It is not possible to delete an existing crawler.
There are more commands that might be helpful:

  • delete
  • activate/deactivate
  • update: Updates the settings for a crawler, e.g. feed-uri
  • force-reload: Import all job advertisements as "new"
@TiSiE TiSiE added the enhancement Create new functionality label Sep 26, 2018
@cbleek
Copy link
Member

cbleek commented Sep 26, 2018

let's start with a delete command

@TiSiE TiSiE self-assigned this Sep 26, 2018
@TiSiE
Copy link
Member

TiSiE commented Sep 26, 2018

Delete action is implemented.

Usage

bin/console simpleimport delete-crawler [--id] <name>

Examples delete by name

bin/console simpleimport delete-crawler unwantedCrawler

Delete by MongoID

bin/console simpleimport delete-crawler --id MongoObjectId

@cbleek
Copy link
Member

cbleek commented Sep 27, 2018

bin/console simpleimport delete-crawler unwantedCrawler results into:

Fatal Error

Call to a member function delete() on null search►

Source file

File: .../src/Controller/DeleteCrawlerConsoleController.php:49

39:            $crawler     = $isCrawlerId ? $this->crawlerRepository->find($crawlerName) : $this->crawlerRepository->findOneByName($crawlerName);
40:
41:            if (!$crawler) {
42:                $model = new ViewModel();
43:                $model->setErrorLevel(2);
44:                $model->setResult(sprintf('Crawler with %s "%s" does not exist.', $isCrawlerId ? 'id' : 'name', $crawlerName));
45:                return $model;
46:            }
47:
48:            foreach ($crawler->getItems() as $item) {
49:                $this->jobRepository->find($item->getDocumentId())->delete();
50:            }
51:
52:            $this->crawlerRepository->remove($crawler);
53:

@cbleek
Copy link
Member

cbleek commented Sep 27, 2018

means, it's possible, that jobs known by the crawler are already deleted in the job repository.

TiSiE added a commit that referenced this issue Oct 17, 2018
This plugin loads a crawler by name or id according to route params.

(refs #14)
TiSiE added a commit that referenced this issue Oct 17, 2018
@cbleek
Copy link
Member

cbleek commented Oct 17, 2018

I cannot see the new update-crawler option

root@php7:/var/www/YAWIK# bin/console simpleimport 
==----------------------------------------------------------------------------------------------------------------------------------------------------------------------------==
                                                                           YAWIK v0.31.1-38-g34449603                                                                           
**----------------------------------------------------------------------------------------------------------------------------------------------------------------------------**

....


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SimpleImport
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Simple import operations
  console simpleimport import [--limit] [--name=] [--id=]                                                         Executes a data import for all         
                                                                                                                                        registered crawlers                    
  console simpleimport add-crawler --name --organization= --feed-uri [--runDelay] [--type] [--jobInitialState]    Adds a new import crawler              

  --limit=INT                 Number of crawlers to check per run. Default 3. 0 means no limit                                                                                 
  --name=STRING               The name of a crawler                                                                                                                            
  --id=STRING                 The Mongo object id of a crawler                                                                                                                 
  --organization==STRING      The ID of an organization                                                                                                                        
  --feed-uri=STRING           The URI pointing to a data to import                                                                                                             
  --runDelay=INT              The number of minutes the next import run will be proceeded again                                                                                
  --type=STRING               The type of an import (e.g. job)                                                                                                                 
  --jobInitialState=STRING    The initial state of an imported job                                                                                                             

  console simpleimport delete-crawler [--id] <name>    Deletes an import crawler                                                                         

  <name>    The name of the crawler to delete.                                                                                                                                 
  --id      When given, treats <name> as the MongoID of the crawler                                                                                                            

Reason for failure: Invalid arguments or no arguments provided
root@php7:/var/www/YAWIK# git log -1
commit 344496035e381da48526db89fe86a0e77f7103e7 (HEAD -> develop, origin/develop, origin/HEAD)
Author: Carsten Bleek <bleek@cross-solution.de>
Date:   Sat Oct 13 20:00:33 2018 +0200

    removes comment for JobsByMail
root@php7:/var/www/YAWIK# cd module/SimpleImport/
root@php7:/var/www/YAWIK/module/SimpleImport# git log -1
commit 0f23a5c14a1467db2aa61c6bc1a97750260b5393 (HEAD -> master, origin/master, origin/HEAD, composer/master)
Merge: 2a02de0 fe52632
Author: Mathias Gelhausen <gelhausen@cross-solution.de>
Date:   Wed Oct 17 12:51:06 2018 +0200

    Merge feature: Console action 'update-crawler' (#14)

@TiSiE
Copy link
Member

TiSiE commented Oct 18, 2018

rm cache/module-c*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Create new functionality
Projects
None yet
Development

No branches or pull requests

3 participants