scrapy / scrapyd

A service daemon to run Scrapy spiders
https://scrapyd.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
2.92k stars 569 forks source link

Transparent list of projects #493

Closed bsekiewicz closed 11 months ago

bsekiewicz commented 11 months ago

A small change increases om website.py the clarity of the available projects (especially when there are many). I'm just wondering if there is additionally an option to list the project version on the home page (or at least the latest version).

From

<p>Available projects: <b>%(projects)s</b></p>

To (more or less)

<p>Available projects:<p>
""" % vars
        if self.root.scheduler.list_projects():
            s += '<ul>'
            for x in sorted(self.root.scheduler.list_projects()):
                s += '<li>' + x + '</li>'
            s += '</ul>'
        else:
            s += '<b>no projects</b>'
        s += """

https://github.com/bsekiewicz/scrapyd/blob/e59ba9b318464c948f21ef7c1eece8c8de860a08/scrapyd/website.py#L93-L102

jpmckinney commented 11 months ago

Sure, we can change it to a list. Can you prepare the pull request?

bsekiewicz commented 11 months ago

It is a simple suggestion that I use because I have a problem with many projects. For discussion, a possible list of versions or the latest version.

<p>Available projects:<p>
""" % vars
        if self.root.scheduler.list_projects():
            s += '<ul>'
            for project in sorted(self.root.scheduler.list_projects()):
                s += '<li>' + project + '</li>'
                s += '<ul>'
                for version in sorted(self.root.eggstorage.list(project)):
                    s += '<li>' + version + '</li>'
                s += '</ul>'
            s += '</ul>'
        else:
            s += '<b>no projects</b>'
        s += """

or

<p>Available projects:<p>
""" % vars
        if self.root.scheduler.list_projects():
            s += '<ul>'
            for project in sorted(self.root.scheduler.list_projects()):
                s += '<li>' + project + ' (' + sorted(self.root.eggstorage.list(project))[-1] + ')</li>'
            s += '</ul>'
        else:
            s += '<b>no projects</b>'
        s += """
bsekiewicz commented 11 months ago

@jpmckinney Ahh. I didn't think about the tests.

jpmckinney commented 11 months ago

I think listing all versions might be too much. For example, I have 73 versions in my current project.

I'm not sure if the latest version is necessary, since all relevant API endpoints assume the latest version if not provided.

bsekiewicz commented 11 months ago

@jpmckinney understanding.

In the case of continuous integration, I want to ensure that the latest version is uploaded to the service. On the other hand, the most important thing for me is for the script to run on a given version, so adding a column with the version to the table in the /jobs location would be more necessary. You may not have such problems, but such a feature is personally helpful to me on Zyte.

Unfortunately, here it's a bit more work, so for now, I won't delve :)

Thanks

jpmckinney commented 11 months ago

In the case of continuous integration, I want to ensure that the latest version is uploaded to the service.

@bsekiewicz Do you need to do that check manually, or can it be automated to use the API?

bsekiewicz commented 9 months ago

@jpmckinney True, I can check it with a simple curl in the pipeline. Thanks.