Coding Aggregation Begins…

1 minute read

Hey, welcome back. If you’re new to the Series of Blogs by Hardik, you may enjoy reading my first blog. In this post, I will briefly describe the proposed API, my approach to the project, and the progress I’ve made so far.

Proposed API for Aggregation

The API proposed introduces two new classes, aggregate and select. These classes are the decorator classes, meaning you should use them as a decorator for an operation.

The aggregate class will be responsible for aggregation of jobs. Using pre condition for filtering can at times get confusing when it comes to aggregates, hence the select class filters the jobs for you.

This is a typical example of how to use aggregation:

@aggregate.groupsof(4, sort='i', reverse=True)
@select(lambda job: job.sp.i > 4)
@FlowProject.operation
def op(*jobs):
    print(jobs)

Please Note: The above API is extremely provisional. Hence users should not refer to this as a guide to use aggregation.

After aggregation, signac-flow will work on a concept that every operation is an aggregate operation. This means that internally, all operations will be treated as aggregate operations, which enables signac-flow to have consistent logic for generating submission scripts and status outputs.

Approach for Implementation

signac-flow supports 6 commands for a FlowProject’s command line interface: run, exec, next, submit, script, and status.

For the community bonding period, the approach to this project was trying to figure out how these commands get executed. For the coding period, the strategy will be to work separately on these commands in the order mentioned above, i.e. firstly, ensuring the proper working of the run command then jumping to exec and so on.

Progress on the Project

For now, I have the first iteration of my project ready for review in this pull request. The signac team made it possible due to their valuable efforts on helping me, specially in the community bonding period.

The code is not yet optimized, and I plan on optimizing the code as soon as I get reviews. As far as the code quality is concerned, I have followed the community guidelines for code style.

A huge thanks to the mentors for their valuable efforts for bringing out the best in me. I also hope to provide users with some syntactic sugar. Thank you for sticking with me again, in my next blog I’ll explain a detailed working of signac-flow with aggregates.

Updated: