-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some simplifications to Scrapyd architecture and internals:
- launcher no longer knows about egg storage - removed get_spider_list_from_eggifile() file and replaced by simpler get_spider_list() which doesn't receive en egg file as argument - changed "egg runner" name to just "runner" to reflect the fact that it doesn't necesarilly run eggs (though it does in the default case) --HG-- rename : scrapyd/eggrunner.py => scrapyd/runner.py
- Loading branch information
1 parent
1d85764
commit 9c06c26
Showing
13 changed files
with
111 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
import shutil | ||
import tempfile | ||
from contextlib import contextmanager | ||
|
||
from scrapyd import get_application | ||
from scrapyd.interfaces import IEggStorage | ||
from scrapyd.eggutils import activate_egg | ||
|
||
@contextmanager | ||
def project_environment(project): | ||
app = get_application() | ||
eggstorage = app.getComponent(IEggStorage) | ||
version, eggfile = eggstorage.get(project) | ||
if eggfile: | ||
prefix = '%s-%s-' % (project, version) | ||
fd, eggpath = tempfile.mkstemp(prefix=prefix, suffix='.egg') | ||
lf = os.fdopen(fd, 'wb') | ||
shutil.copyfileobj(eggfile, lf) | ||
lf.close() | ||
activate_egg(eggpath) | ||
else: | ||
eggpath = None | ||
try: | ||
yield | ||
finally: | ||
if eggpath: | ||
os.remove(eggpath) | ||
|
||
def main(): | ||
project = os.environ['SCRAPY_PROJECT'] | ||
with project_environment(project): | ||
from scrapy.cmdline import execute | ||
execute() | ||
|
||
if __name__ == '__main__': | ||
main() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters